Adventure Creator  1.68.4
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.Hotspot Class Reference
Inheritance diagram for AC.Hotspot:
AC.ITranslatable

Public Member Functions

void RunExamineInteraction ()
 Runs the Hotspot's 'Examine' interaction, if one is defined.
 
void RunUseInteraction (int iconID=-1)
 Runs one of the Hotspot's 'Use' interactions. More...
 
void RunInventoryInteraction (int invID=-1)
 Runs one of the Hotspot's 'Inventory' interactions. More...
 
void RunInventoryInteraction (InvItem invItem=null)
 Runs one of the Hotspot's 'Inventory' interactions. More...
 
void SetProximity (bool isGameplay)
 Highlights the Hotspot based on the mouse cursor's proximity. More...
 
bool UpgradeSelf ()
 Upgrades the Hotspot from a previous version of Adventure Creator. More...
 
void DrawHotspotIcon (bool inWorldSpace=false)
 Draws an icon at the Hotspot's centre. More...
 
string GetFullLabel (int languageNumber=0, int cursorID=-1)
 Gets the label to display when the cursor is over this Hotspot, with cursor names and active inventory item included if appropriate. More...
 
void UpdateIcon ()
 
void UpdateProximity (DetectHotspots detectHotspots)
 Sets the layer of the Hotspot according to whether or not it is within the proximity of a Hotspot detector. More...
 
bool UpdateUnhandledVisibility ()
 Sets the layer of the Hotspot according to whether or not it has a "Use" interaction for the currently-selected cursor More...
 
void SetIconVisibility (bool makeVisible, float speed=5f)
 Shows or hides the Hotspot's associated icon, provided that the Settings Manager's hotspotIconDisplay = HotspotIconDisplay.ViaScriptOnly More...
 
Button GetFirstUseButton ()
 Gets the Button that represents the first-available "Use" interaction. More...
 
int GetFirstUseIcon ()
 Gets the ID of the icon that represents the first-available "Use" interaction. More...
 
Button GetUseButton (int iconID)
 Gets the Button that represents the first-available "Use" interaction associated with a given interaction icon. More...
 
Button GetInvButton (int invID)
 Gets the Button that represents the first-available "Inventory" interaction associated with a given inventory item. More...
 
bool IsInventoryButton (Button _button)
 Checks if a given Button is one of the Hotpspot's invButtons More...
 
int FindFirstEnabledInteraction ()
 Gets the index number of the Button that represents the first-available "Use" interaction. More...
 
void LimitToCamera (_Camera _limitToCamera)
 Enables or disables the Hotspot, based on the active camera, if limitToCamera has been assigned. More...
 
void TurnOn ()
 Enables the Hotspot.
 
void TurnOn (bool manualSet)
 Enables the Hotspot. More...
 
void TurnOff ()
 Disables the Hotspot.
 
void TurnOff (bool manualSet)
 Disables the Hotspot. More...
 
bool IsOn ()
 Checks if the Hotspot is enabled or not. More...
 
bool PlayerIsWithinBoundary ()
 Checks if the Player is within the Hotspot's interactableBoundary, if assigned. More...
 
void Select ()
 
void Deselect ()
 
void DeselectInstant ()
 
void ShowInteractionMenus ()
 Shows any Menus with appearType = AppearType.OnInteraction, connected to a the Hotspot.
 
bool IsSingleInteraction ()
 Checks if oneClick = True, and the Hotspot has at least one "Use" interaction defined. More...
 
int GetInventoryReferences (int invID)
 
Vector2 GetIconScreenPosition ()
 Gets the position of the Hotspot's icon, in Screen Space. More...
 
Vector3 GetIconPosition (bool inLocalSpace=false)
 Gets the position of the Hotspot's icon More...
 
void ResetMainIcon ()
 
bool HasContextUse ()
 Checks if the Hotspot has at least one "Use" interaction defined. More...
 
bool HasContextLook ()
 Checks if the Hotspot has at least one "Examine" interaction defined. More...
 
int GetNextInteraction (int i, int numInvInteractions)
 Gets the next interaction index. More...
 
int GetPreviousInteraction (int i, int numInvInteractions)
 Gets the previous interaction index. More...
 
string GetName (int languageNumber)
 Gets the Hotspot's current display name. More...
 
void SetName (string newName, int _lineID)
 Renames the Hotspot mid-game. More...
 
bool HasInventoryInteraction (InvItem invItem)
 Checks if the Hotspot has an active interaction for a given inventory item, or a generic unhandled inventory interaction. More...
 
string GetTranslatableString (int index)
 
int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
string GetOwner ()
 Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element. More...
 
bool OwnerIsPlayer ()
 Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line. More...
 
AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 

Public Attributes

bool showInEditor = true
 
AC.InteractionSource interactionSource
 
_Camera limitToCamera = null
 
InteractiveBoundary interactiveBoundary = null
 
string hotspotName
 
int lineID = -1
 
Highlight highlight
 
Marker walkToMarker
 
Transform centrePoint
 
bool provideUseInteraction
 
Button useButton = new Button()
 
List< ButtonuseButtons = new List<Button>()
 
bool oneClick = false
 
bool provideLookInteraction
 
Button lookButton = new Button()
 
bool provideInvInteraction
 
List< ButtoninvButtons = new List<Button>()
 
bool provideUnhandledInvInteraction
 
Button unhandledInvButton = new Button()
 
bool drawGizmos = true
 
int lastInteractionIndex = 0
 
int displayLineID = -1
 
string iconSortingLayer = ""
 
int iconSortingOrder = 0
 
DoubleClickingHotspot doubleClickingHotspot = DoubleClickingHotspot.MakesPlayerRun
 
bool playerTurnsHead = true
 

Detailed Description

This component provides the player with a region of space in the scene that can be interacted with. Data for each interaction is stored within the Button class, and this component stores them in Lists. The number of interactions, and how exactly they are triggered, are determined in SettingsManager.

Member Function Documentation

◆ CanTranslate()

bool AC.Hotspot.CanTranslate ( int  index)

Checks if a given text index can and should be translated.

Parameters
indexThe index of the translatable text
Returns
True if the text can and should be translated

Implements AC.ITranslatable.

◆ Deselect()

void AC.Hotspot.Deselect ( )

De-selects the Hotspot.

◆ DeselectInstant()

void AC.Hotspot.DeselectInstant ( )

De-selects the Hotspot instantly.

◆ DrawHotspotIcon()

void AC.Hotspot.DrawHotspotIcon ( bool  inWorldSpace = false)

Draws an icon at the Hotspot's centre.

Parameters
inWorldSpaceIf True, the icon shall be drawn as a sprite in world space, as opposed to an OnGUI graphic in screen space.

◆ FindFirstEnabledInteraction()

int AC.Hotspot.FindFirstEnabledInteraction ( )

Gets the index number of the Button that represents the first-available "Use" interaction.

Returns
The index number of the Button that represents the first-available "Use" interaction

◆ GetFirstUseButton()

Button AC.Hotspot.GetFirstUseButton ( )

Gets the Button that represents the first-available "Use" interaction.

Returns
The Button that represents the first-available "Use" interaction

◆ GetFirstUseIcon()

int AC.Hotspot.GetFirstUseIcon ( )

Gets the ID of the icon that represents the first-available "Use" interaction.

Returns
The ID of the icon that represents the first-available "Use" interaction. If no appropriate interaction is found, -1 is returned

◆ GetFullLabel()

string AC.Hotspot.GetFullLabel ( int  languageNumber = 0,
int  cursorID = -1 
)

Gets the label to display when the cursor is over this Hotspot, with cursor names and active inventory item included if appropriate.

Parameters
languageNumberThe index number of the language to return the line in, where 0 = the game's original language.
cursorIDThe ID number of the cursor icon (set in the Cursor Manager) to get the label for. If <0, the active cursor will be used.
Returns
The label to display when the cursor is over this Hotspot, with cursor names and active inventory item included if appropriate.

◆ GetIconPosition()

Vector3 AC.Hotspot.GetIconPosition ( bool  inLocalSpace = false)

Gets the position of the Hotspot's icon

<param = "inLocalSpace">If True, the position returned will be relative to the centre of the Hotspot's transform, rather than the scene's origin

Returns
The position of the Hotspot's icon

◆ GetIconScreenPosition()

Vector2 AC.Hotspot.GetIconScreenPosition ( )

Gets the position of the Hotspot's icon, in Screen Space.

Returns
The position of the Hotspot's icon, in Screen Space.

◆ GetInvButton()

Button AC.Hotspot.GetInvButton ( int  invID)

Gets the Button that represents the first-available "Inventory" interaction associated with a given inventory item.

Parameters
invIDThe ID number of the associated inventory item, as defined in the Inventory Manager.
Returns
The Button that represents the first-available "Inventory" interaction associated with a given inventory item.

◆ GetName()

string AC.Hotspot.GetName ( int  languageNumber)

Gets the Hotspot's current display name.

Parameters
languageNumberThe index number of the game's current language
Returns
The Hotspot's current display name

◆ GetNextInteraction()

int AC.Hotspot.GetNextInteraction ( int  i,
int  numInvInteractions 
)

Gets the next interaction index.

Parameters
iThe current interaction index
numInvInteractionsThe number of relevant "Inventory" interactions that match the current cursor
Returns
The next interaction index

◆ GetNumTranslatables()

int AC.Hotspot.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetOwner()

string AC.Hotspot.GetOwner ( )

Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element.

Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetPreviousInteraction()

int AC.Hotspot.GetPreviousInteraction ( int  i,
int  numInvInteractions 
)

Gets the previous interaction index.

Parameters
iThe current interaction index
numInvInteractionsThe number of relevant "Inventory" interactions that match the current cursor
Returns
The previous interaction index

◆ GetTranslatableString()

string AC.Hotspot.GetTranslatableString ( int  index)

ITranslatable implementation

Implements AC.ITranslatable.

◆ GetTranslationID()

int AC.Hotspot.GetTranslationID ( int  index)

Gets the translation ID of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation ID of the text

Implements AC.ITranslatable.

◆ GetTranslationType()

AC_TextType AC.Hotspot.GetTranslationType ( int  index)

Gets the translation type of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation type of a given text index.

Implements AC.ITranslatable.

◆ GetUseButton()

Button AC.Hotspot.GetUseButton ( int  iconID)

Gets the Button that represents the first-available "Use" interaction associated with a given interaction icon.

Parameters
iconIDThe ID number of the associated interaction icon, as defined in the Cursor Manager.
Returns
The Button that represents the first-available "Use" interaction associated with a given interaction ID.

◆ HasContextLook()

bool AC.Hotspot.HasContextLook ( )

Checks if the Hotspot has at least one "Examine" interaction defined.

Returns
True if the Hotspot has at least one "Examine" interaction defined.

◆ HasContextUse()

bool AC.Hotspot.HasContextUse ( )

Checks if the Hotspot has at least one "Use" interaction defined.

Returns
True if the Hotspot has at least one "Use" interaction defined.

◆ HasExistingTranslation()

bool AC.Hotspot.HasExistingTranslation ( int  index)

Checks if a given text index has already been assigned a unique translation ID.

Parameters
indexThe index of the translatable text
Returns
True if the text has been assigned a unique translation ID

Implements AC.ITranslatable.

◆ HasInventoryInteraction()

bool AC.Hotspot.HasInventoryInteraction ( InvItem  invItem)

Checks if the Hotspot has an active interaction for a given inventory item, or a generic unhandled inventory interaction.

Parameters
invItemThe inventory item to check for
Returns
True if the Hotspot has an active interaction for the inventory item, or a generic unhandled inventory interaction.

◆ IsInventoryButton()

bool AC.Hotspot.IsInventoryButton ( Button  _button)

Checks if a given Button is one of the Hotpspot's invButtons

Parameters
_buttonThe Button to check
Returns
True if the Button is one of the Hotspot's invButtons

◆ IsOn()

bool AC.Hotspot.IsOn ( )

Checks if the Hotspot is enabled or not.

Returns
True if the Hotspot is enabled. If the Hotspot is not active only because its limitToCamera is not active, then True will be returned.

◆ IsSingleInteraction()

bool AC.Hotspot.IsSingleInteraction ( )

Checks if oneClick = True, and the Hotspot has at least one "Use" interaction defined.

Returns
True if oneClick = True, and the Hotspot has at least one "Use" interaction defined.</summmary>

◆ LimitToCamera()

void AC.Hotspot.LimitToCamera ( _Camera  _limitToCamera)

Enables or disables the Hotspot, based on the active camera, if limitToCamera has been assigned.

Parameters
_limitToCameraA _Camera that, if matches the limitToCamera variable, will turn the Hotspot on - otherwise the Hotspot will turn off

◆ OwnerIsPlayer()

bool AC.Hotspot.OwnerIsPlayer ( )

Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line.

Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ PlayerIsWithinBoundary()

bool AC.Hotspot.PlayerIsWithinBoundary ( )

Checks if the Player is within the Hotspot's interactableBoundary, if assigned.

Returns
True if the Player is within the Hotspot's interactableBoundary, if assigned. If no InteractableBoundary is assigned, or there is no Player, then True will be returned.

◆ ResetMainIcon()

void AC.Hotspot.ResetMainIcon ( )

Clears the Hotspot's internal 'use' icon, as used when the Hotspot is highlighted.

◆ RunInventoryInteraction() [1/2]

void AC.Hotspot.RunInventoryInteraction ( int  invID = -1)

Runs one of the Hotspot's 'Inventory' interactions.

Parameters
invIDThe ID number of the InvItem associated with the Button. If no number is supplied, that of the currently-selected inventory item will be used.

◆ RunInventoryInteraction() [2/2]

void AC.Hotspot.RunInventoryInteraction ( InvItem  invItem = null)

Runs one of the Hotspot's 'Inventory' interactions.

Parameters
invItemThe InvItem associated with the Button. If no item is supplied, that of the currently-selected inventory item will be used.

◆ RunUseInteraction()

void AC.Hotspot.RunUseInteraction ( int  iconID = -1)

Runs one of the Hotspot's 'Use' interactions.

Parameters
iconIDThe ID number of the CursorIcon associated with the Button. If no number is supplied, the first enabled Use interaction will be run.

◆ Select()

void AC.Hotspot.Select ( )

Selects the Hotspot.

◆ SetIconVisibility()

void AC.Hotspot.SetIconVisibility ( bool  makeVisible,
float  speed = 5f 
)

Shows or hides the Hotspot's associated icon, provided that the Settings Manager's hotspotIconDisplay = HotspotIconDisplay.ViaScriptOnly

Parameters
makeVisibleIf True, the icon will be shown. If false, the icon will be hidden
speedThe speed at which to show or hide the icon. If <=0, the transition will be instantaneous.

◆ SetName()

void AC.Hotspot.SetName ( string  newName,
int  _lineID 
)

Renames the Hotspot mid-game.

Parameters
newNameThe new name of the Hotspot
_lineIDThe translation ID number assocated with the new name, as set by SpeechManager

◆ SetProximity()

void AC.Hotspot.SetProximity ( bool  isGameplay)

Highlights the Hotspot based on the mouse cursor's proximity.

Parameters
isGameplayIf True, then it is during gameplay, and the highlight effect wil work

◆ SetTranslationID()

void AC.Hotspot.SetTranslationID ( int  index,
int  lineID 
)

Sets the translation ID of a given text index

Parameters
indexThe index of the translatable text
lineIDThe new translation ID to assign the translatable text

Implements AC.ITranslatable.

◆ TurnOff()

void AC.Hotspot.TurnOff ( bool  manualSet)

Disables the Hotspot.

Parameters
manualSetIf True, then the Hotspot will be considered 'Off" when saving

◆ TurnOn()

void AC.Hotspot.TurnOn ( bool  manualSet)

Enables the Hotspot.

Parameters
manualSetIf True, then the Hotspot will be considered 'Off" when saving

◆ UpdateIcon()

void AC.Hotspot.UpdateIcon ( )

Recalculates the alpha value of the Hotspot's icon.

◆ UpdateProximity()

void AC.Hotspot.UpdateProximity ( DetectHotspots  detectHotspots)

Sets the layer of the Hotspot according to whether or not it is within the proximity of a Hotspot detector.

Parameters
detectHotspotThe DetectHotspots component to check the proximity against

◆ UpdateUnhandledVisibility()

bool AC.Hotspot.UpdateUnhandledVisibility ( )

Sets the layer of the Hotspot according to whether or not it has a "Use" interaction for the currently-selected cursor

Returns
True if the Hotspot is on the default layer, False if not

◆ UpgradeSelf()

bool AC.Hotspot.UpgradeSelf ( )

Upgrades the Hotspot from a previous version of Adventure Creator.

Returns
True if the upgrade was successful

Member Data Documentation

◆ centrePoint

Transform AC.Hotspot.centrePoint

A Transform that represents the centre of the Hotspot, if it is not physically at the same point as the Hotspot's GameObject itself

◆ displayLineID

int AC.Hotspot.displayLineID = -1

The translation ID number of the Hotspot's name, if it was changed mid-game

◆ doubleClickingHotspot

DoubleClickingHotspot AC.Hotspot.doubleClickingHotspot = DoubleClickingHotspot.MakesPlayerRun

The effect that double-clicking on the Hotspot has, if interactionMethod = AC_InteractionMethod.ContextSensitive in SettingsManager (MakesPlayerRun, TriggersInteractionInstantly)

◆ drawGizmos

bool AC.Hotspot.drawGizmos = true

If True, then a Gizmo may be drawn in the Scene window at the Hotspots's position, if showInEditor = True

◆ highlight

Highlight AC.Hotspot.highlight

The Highlight component that controls any highlighting effects associated with the Hotspot

◆ hotspotName

string AC.Hotspot.hotspotName

The display name, if not the GameObject's name

◆ iconSortingLayer

string AC.Hotspot.iconSortingLayer = ""

The 'Sorting Layer' of the icon's SpriteRenderer, if drawn in World Space

◆ iconSortingOrder

int AC.Hotspot.iconSortingOrder = 0

The 'Order in Layer' of the icon's SpriteRenderer, if drawn in World Space

◆ interactionSource

AC.InteractionSource AC.Hotspot.interactionSource

The source of the commands that are run when an option is chosen (InScene, AssetFile, CustomScript)

◆ interactiveBoundary

InteractiveBoundary AC.Hotspot.interactiveBoundary = null

If assigned, then the Hotspot will only be interactive when the player is within this Trigger Collider's boundary

◆ invButtons

List<Button> AC.Hotspot.invButtons = new List<Button>()

A List of all available 'Inventory' interactions

◆ lastInteractionIndex

int AC.Hotspot.lastInteractionIndex = 0

The index of the last-active interaction

◆ limitToCamera

_Camera AC.Hotspot.limitToCamera = null

If assigned, then the Hotspot will only be interactive when the assigned _Camera is active

◆ lineID

int AC.Hotspot.lineID = -1

The translation ID number of the Hotspot's name, as generated by SpeechManager

◆ lookButton

Button AC.Hotspot.lookButton = new Button()

The 'Examine' interaction, if interactionMethod = AC_InteractionMethod.ContextSensitive in SettingsManager

◆ oneClick

bool AC.Hotspot.oneClick = false

If True, then clicking the Hotspot will run the Hotspot's first interaction in useButtons, regardless of the interactionMethod chosen in SettingsManager

◆ playerTurnsHead

bool AC.Hotspot.playerTurnsHead = true

If True, then the player will turn their head when the Hotspot is selected (if SettingsManager's playerFacesHotspots = True)

◆ provideInvInteraction

bool AC.Hotspot.provideInvInteraction

If True, then the Hotspot can have 'Inventory' interactions

◆ provideLookInteraction

bool AC.Hotspot.provideLookInteraction

If True, then the Hotspot can have an 'Examine' interaction, if interactionMethod = AC_InteractionMethod.ContextSensitive in SettingsManager

◆ provideUnhandledInvInteraction

bool AC.Hotspot.provideUnhandledInvInteraction

If True, then the Hotspot can have an unhandled 'Inventory' interaction

◆ provideUseInteraction

bool AC.Hotspot.provideUseInteraction

If True, then the Hotspot can have 'Use" interactions

◆ showInEditor

bool AC.Hotspot.showInEditor = true

If True, then a Gizmo will be drawn in the Scene window at the Hotspots's position

◆ unhandledInvButton

Button AC.Hotspot.unhandledInvButton = new Button()

The unhandled 'Inventory' interaction, which will be run if the player uses an inventory item on the Hotspot, and it is not handled within invButtons

◆ useButton

Button AC.Hotspot.useButton = new Button()

No longer used by Adventure Creator, but kept so that older projects can be upgraded

◆ useButtons

List<Button> AC.Hotspot.useButtons = new List<Button>()

A List of all available 'Use' interactions

◆ walkToMarker

Marker AC.Hotspot.walkToMarker

The Marker that the player can optionally automatically walk to before an Interaction runs