Hotspot
namespace Griff.Modules.Adventures;
public sealed class Hotspot : Component, IPointOutline, IDrawable, IDialogueStarter, IArrivalSpotSomething in an adventure to look at and use with the mouse, with no code: a door, a key on the floor, a painting, a character to talk to. Hovering over it shows its Name by the pointer and changes the pointer to its Cursor; clicking it sends the player’s Walker to stand by it (at StandAt), and then looks at it (a right click, or a left click with the walker’s verb on Look) or uses it (a left click). Each verb can say a line (the walker says it over its head), do an action (a door’s Open, a dialogue’s Start, a switch’s Toggle…), set or clear a flag and send a message; using it can start its Dialogue. Something with nothing to use is looked at instead. Its shape is its Points, or else its collider, its sprite, or a square a unit across.
NeedsFlag keeps it out of reach until a flag is set (a hidden drawer), or while one is (not TookKey, for a key that’s gone once taken), and HideWhenGone hides it then too. Using it can put items in the walker’s inventory (UseGives), and items from the InventoryBar are used on it by its UseWiths (anything else gets its WrongItemLine). Looking and using are counted (TimesLooked, TimesUsed), for a Counter or a trigger. Its Look and Use actions do the same as a click, for a trigger or a script, and Use Item uses an item on it. With GoesTo it’s a way to another room: using it goes to that scene, where the walker arrives at ArriveAt.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”ArriveAt
Section titled “ArriveAt”public string? ArriveAt { get; set; }Where the walker arrives in the GoesTo scene: the name of a hotspot there (it stands at that one’s Stand At: the door back), or of anything else (it stands where that is). Empty leaves it where that scene has it.
Called
Section titled “Called”public string Called { get; }What it’s called by the pointer: its Name, or its entity’s name.
CanUse
Section titled “CanUse”public bool CanUse { get; }True if using it does anything; with nothing to use, a click to use it looks at it instead.
Cursor
Section titled “Cursor”public MouseCursor Cursor { get; set; }The pointer shown over it.
GivenPoints
Section titled “GivenPoints”public IReadOnlyList<Vector2> GivenPoints { get; }GoesTo
Section titled “GoesTo”public string? GoesTo { get; set; }A scene using it goes to, once the walker is there, e.g. “Garden”: a door or a path to the next room. The screen fades out and in, and the walker there arrives at ArriveAt.
HideWhenGone
Section titled “HideWhenGone”public bool HideWhenGone { get; set; }Hides its entity while its NeedsFlag keeps it out of reach, and shows it again once it doesn’t: a key that’s gone once taken, a ladder that’s there once it’s put up.
LookDo
Section titled “LookDo”public string? LookDo { get; set; }An action done on looking at it, on its LookTargets (or itself): a dialogue’s “Start”, a switch’s “Toggle”, a sound player’s “Play”…
LookFlag
Section titled “LookFlag”public string? LookFlag { get; set; }A flag set on looking at it, e.g. “SawCrack”; “not Name” clears one.
LookLine
Section titled “LookLine”public string? LookLine { get; set; }What the walker says on looking at it, e.g. “A rusty old key.”
LookMessage
Section titled “LookMessage”public string? LookMessage { get; set; }A message sent on looking at it, with the walker as its data.
LookTargets
Section titled “LookTargets”public string? LookTargets { get; set; }What Look Do is done on, by name, separated by commas (those inside this one first). Empty does it on this entity.
LookWith
Section titled “LookWith”public string? LookWith { get; set; }What Look Do is done with, for an action that takes a value (Damage 2). Empty uses the action’s own default.
public string? Name { get; set; }What it’s called by the pointer, e.g. “Old Door”; empty uses its entity’s name. Read as the “Name” output.
NeedsFlag
Section titled “NeedsFlag”public string? NeedsFlag { get; set; }A flag it needs to be there, e.g. “OpenedDrawer”, or “not TookKey” for one that’s gone once a flag is set: until then the pointer passes over it and clicks walk past. Empty is always there.
Points
Section titled “Points”public string? Points { get; set; }Its shape, as “x y” pairs separated by semicolons round the entity in its own units, its points dragged in the Scene view, for something painted into the background (a window, a crack in the wall). Empty uses its collider, or else its sprite, or else a square a unit across.
StandAt
Section titled “StandAt”public Vector2 StandAt { get; set; }Where the walker stands to look at or use it, from its entity, in world units: (0, -1.5) is in front of a door 1.5 below its middle. A spot off the floor walks as close as it can.
StandPoint
Section titled “StandPoint”public Vector2 StandPoint { get; }Where the walker stands to look at or use it, in the world (before walking as close as it can get).
TimesLooked
Section titled “TimesLooked”public int TimesLooked { get; set; }How many times it has been looked at. The game counts them.
TimesUsed
Section titled “TimesUsed”public int TimesUsed { get; set; }How many times it has been used. The game counts them.
public string? UseDo { get; set; }An action done on using it, on its UseTargets (or itself): a door’s “Open”, a switch’s “Toggle”, a dialogue’s “Start”, a spawner’s “Spawn”…
UseFlag
Section titled “UseFlag”public string? UseFlag { get; set; }A flag set on using it, e.g. “TookKey”; “not Name” clears one.
UseGives
Section titled “UseGives”public string? UseGives { get; set; }Items put in the walker’s inventory on using it, separated by commas, each with how many if more than one: “Key”, “Coin 3, Map”. For something taken once, give it a Use Flag and Needs Flag “not” that flag, with Hide When Gone.
UseLine
Section titled “UseLine”public string? UseLine { get; set; }What the walker says on using it, e.g. “It won’t budge.”
UseMessage
Section titled “UseMessage”public string? UseMessage { get; set; }A message sent on using it, with the walker as its data.
UseTalks
Section titled “UseTalks”public bool UseTalks { get; set; }Using it starts the Dialogue on its entity: talking to a character.
UseTargets
Section titled “UseTargets”public string? UseTargets { get; set; }What Use Do is done on, by name, separated by commas (those inside this one first). Empty does it on this entity.
UseWith
Section titled “UseWith”public string? UseWith { get; set; }What Use Do is done with, for an action that takes a value. Empty uses the action’s own default.
WalkThere
Section titled “WalkThere”public bool WalkThere { get; set; }Walks over to it before looking or using; untick it for something seen from afar (the moon, a distant ship).
WrongItemLine
Section titled “WrongItemLine”public string? WrongItemLine { get; set; }What the walker says when an item it has no UseWith for is used on it, e.g. “The dog sniffs it and looks away.” Empty uses the inventory bar’s Wrong Line.
Methods
Section titled “Methods”Contains
Section titled “Contains”public bool Contains(Vector2 point)True if point (in the world) is inside its Points; false without three of them.
FromWorld
Section titled “FromWorld”public Vector2 FromWorld(Vector2 point)public void Look()Walks the player’s walker over and looks at it, as a right click on it does.
ToWorld
Section titled “ToWorld”public Vector2 ToWorld(Vector2 point)public void Use()Walks the player’s walker over and uses it, as a left click on it does.
UseItem
Section titled “UseItem”public void UseItem(string? item)Walks the player’s walker over and uses item on it (if the walker has one), as picking it from the inventory bar and clicking this does.
Events
Section titled “Events”public event Action<Walker, AdventureVerb>? DoneRaised as it’s looked at or used, with the walker and the verb (Use falls back to Look when it has nothing to use).