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

Public Member Functions

void UpdateInteraction ()
 
void UpdateInventory ()
 
void SetActiveHotspot (Hotspot _hotspot)
 Sets the active Hotspot, provided that the chosen hotspot detection method in Settings Manager is CustomScript. More...
 
void DeselectHotspot (bool isInstant=false)
 De-selects the active Hotspot. More...
 
bool DoesHotspotHaveInventoryInteraction ()
 Checks if the active Hotspot has an enabled inventory interaction that matches the currently-selected inventory item. More...
 
void UseHotspot (Hotspot _hotspot, int selectedCursorID=-1)
 Runs a Hotspot's 'use' interaction. More...
 
void ExamineHotspot (Hotspot _hotspot)
 Runs a Hotspot's 'look' interaction. More...
 
void UseInventoryOnHotspot (Hotspot _hotspot, int inventoryItemID, bool requireCarry=true)
 Runs a Hotspot's 'use inventory' interaction. More...
 
string GetLabel (int languageNumber, Hotspot overrideHotspot=null)
 Gets the current Hotspot label, which may also include the current interaction verb (e.g. "Take X") or the currently-selected item (e.g. "Use Y on Z") More...
 
string GetLabelPrefix (Hotspot _hotspot, InvItem _invItem, int languageNumber=0, int cursorID=-1)
 Gets the prefix for the Hotspot label (the label without the interactive Hotspot or inventory item) More...
 
Vector2 GetHotspotScreenCentre ()
 Gets the centre of the active Hotspot in screen space More...
 
Vector2 GetLastHotspotScreenCentre ()
 Gets the centre of the last-active Hotspot in screen space More...
 
bool IsMouseOverHotspot ()
 Checks if the cursor is currently over a Hotspot. More...
 
bool IsDroppingInventory ()
 Checks if the player is de-selecting or dropping the inventory in this frame. More...
 
Hotspot GetActiveHotspot ()
 Gets the active Hotspot. More...
 
Hotspot GetLastOrActiveHotspot ()
 Gets the last Hotspot to be active, even if none is currently active. More...
 
int GetActiveUseButtonIconID ()
 Gets the ID number of the current "Use" Button when the interface allows for cursors being cycled when over Hotspots or inventory items. More...
 
int GetActiveInvButtonID ()
 Gets the ID number of the current "Inventory" Button when the interface allows for cursors being cycled when over Hotspots or inventory items. More...
 
void SetNextInteraction ()
 
void SetPreviousInteraction ()
 
void ResetInteractionIndex ()
 
int GetInteractionIndex ()
 Gets the active Hotspot's selected interaction index. The interaction index is the position inside a combined List of the Hotspot or inventory item's enabled Use and Inventory Buttons. More...
 
void SetInteractionIndex (int _interactionIndex)
 Sets the active Hotspot's selected interaction index. The interaction index is the position inside a combined List of the Hotspot or inventory item's enabled Use and Inventory Buttons. More...
 
void RestoreInventoryInteraction ()
 
void ClickInteractionIcon (AC.Menu _menu, int iconID)
 Runs the appropriate interaction after the clicking of a MenuInteraction element. More...
 
Hotspot GetHotspotMovingTo ()
 Gets the Hotspot that the Player is moving towards. More...
 
void StopMovingToHotspot ()
 

Properties

string MovingToHotspotLabel [get]
 
bool InPreInteractionCutscene [get]
 

Detailed Description

This script processes Hotspot interactions. It should be placed on the GameEngine prefab.

Member Function Documentation

◆ ClickInteractionIcon()

void AC.PlayerInteraction.ClickInteractionIcon ( AC.Menu  _menu,
int  iconID 
)

Runs the appropriate interaction after the clicking of a MenuInteraction element.

Parameters
_menuThe Menu that contains the MenuInteraction element
iconIDThe ID number of the "Use" icon, defined in CursorManager, that was clicked on

◆ DeselectHotspot()

void AC.PlayerInteraction.DeselectHotspot ( bool  isInstant = false)

De-selects the active Hotspot.

Parameters
isInstantIf True, then any highlight effects being applied to the Hotspot will be instantly removed

◆ DoesHotspotHaveInventoryInteraction()

bool AC.PlayerInteraction.DoesHotspotHaveInventoryInteraction ( )

Checks if the active Hotspot has an enabled inventory interaction that matches the currently-selected inventory item.

Returns
True if the active Hotspot has an an enabled inventory interaction that matches the currently-selected inventory item

◆ ExamineHotspot()

void AC.PlayerInteraction.ExamineHotspot ( Hotspot  _hotspot)

Runs a Hotspot's 'look' interaction.

Parameters
_hotspotThe Hotspot to examine

◆ GetActiveHotspot()

Hotspot AC.PlayerInteraction.GetActiveHotspot ( )

Gets the active Hotspot.

Returns
The active Hotspot

◆ GetActiveInvButtonID()

int AC.PlayerInteraction.GetActiveInvButtonID ( )

Gets the ID number of the current "Inventory" Button when the interface allows for cursors being cycled when over Hotspots or inventory items.

Returns
The ID number of the current "Inventory" Button when the interface allows for cursors being cycled when over Hotspots or inventory items.

◆ GetActiveUseButtonIconID()

int AC.PlayerInteraction.GetActiveUseButtonIconID ( )

Gets the ID number of the current "Use" Button when the interface allows for cursors being cycled when over Hotspots or inventory items.

Returns
The ID number of the current "Use" Button when the interface allows for cursors being cycled when over Hotspots or inventory items.

◆ GetHotspotMovingTo()

Hotspot AC.PlayerInteraction.GetHotspotMovingTo ( )

Gets the Hotspot that the Player is moving towards.

Returns
The Hotspot that the Player is moving towards

◆ GetHotspotScreenCentre()

Vector2 AC.PlayerInteraction.GetHotspotScreenCentre ( )

Gets the centre of the active Hotspot in screen space

Returns
The centre of the active Hotspot in screen space

◆ GetInteractionIndex()

int AC.PlayerInteraction.GetInteractionIndex ( )

Gets the active Hotspot's selected interaction index. The interaction index is the position inside a combined List of the Hotspot or inventory item's enabled Use and Inventory Buttons.

Returns
The active Hotspot's selected interaction index

◆ GetLabel()

string AC.PlayerInteraction.GetLabel ( int  languageNumber,
Hotspot  overrideHotspot = null 
)

Gets the current Hotspot label, which may also include the current interaction verb (e.g. "Take X") or the currently-selected item (e.g. "Use Y on Z")

Parameters
languageNumberThe index number of the language to display the label in
overrideHotspotThe returned label will refer to this Hotspot if provided; otherwise, the currently-active Hotspot will be referred to instead
Returns
The current Hotspot label, which may also include the current interaction verb (e.g. "Take X") or the currently-selected item (e.g. "Use Y on Z")

◆ GetLabelPrefix()

string AC.PlayerInteraction.GetLabelPrefix ( Hotspot  _hotspot,
InvItem  _invItem,
int  languageNumber = 0,
int  cursorID = -1 
)

Gets the prefix for the Hotspot label (the label without the interactive Hotspot or inventory item)

Parameters
_hotspotThe Hotspot to get the prefix label for. This will be ignored if _invItem is not null
_invItemThe Inventory Item to get the prefix label for. This will override _hotspot if not null
languageNumberThe index number of the language to return. If 0, the default language will be used
cursorIDThe ID number of the cursor to rely on, if appropriate. If <0, the active cursor will be used
Returns
The prefix for the Hotspot label

◆ GetLastHotspotScreenCentre()

Vector2 AC.PlayerInteraction.GetLastHotspotScreenCentre ( )

Gets the centre of the last-active Hotspot in screen space

Returns
The centre of the last-active Hotspot in screen space

◆ GetLastOrActiveHotspot()

Hotspot AC.PlayerInteraction.GetLastOrActiveHotspot ( )

Gets the last Hotspot to be active, even if none is currently active.

Returns
The last Hotspot to be active

◆ IsDroppingInventory()

bool AC.PlayerInteraction.IsDroppingInventory ( )

Checks if the player is de-selecting or dropping the inventory in this frame.

Returns
True if the player is de-selecting or dropping the inventory in this frame

◆ IsMouseOverHotspot()

bool AC.PlayerInteraction.IsMouseOverHotspot ( )

Checks if the cursor is currently over a Hotspot.

<returs>True if the cursor is currently over a Hotspot

◆ ResetInteractionIndex()

void AC.PlayerInteraction.ResetInteractionIndex ( )

Resets the active Hotspot or inventory item's selected interaction index. The interaction index is the position inside a combined List of the Hotspot or inventory item's enabled Use and Inventory Buttons.

◆ RestoreInventoryInteraction()

void AC.PlayerInteraction.RestoreInventoryInteraction ( )

Restores the interaction index to the last value used by the active inventory item. The interaction index is the position inside a combined List of the inventory item's enabled Use and Inventory Buttons.

◆ SetActiveHotspot()

void AC.PlayerInteraction.SetActiveHotspot ( Hotspot  _hotspot)

Sets the active Hotspot, provided that the chosen hotspot detection method in Settings Manager is CustomScript.

Parameters
_hotspotThe Hotspot to make active

◆ SetInteractionIndex()

void AC.PlayerInteraction.SetInteractionIndex ( int  _interactionIndex)

Sets the active Hotspot's selected interaction index. The interaction index is the position inside a combined List of the Hotspot or inventory item's enabled Use and Inventory Buttons.

Parameters
_interactionIndexThe new interaction index

◆ SetNextInteraction()

void AC.PlayerInteraction.SetNextInteraction ( )

Cycles forward to the next available interaction for the active Hotspot or inventory item.

◆ SetPreviousInteraction()

void AC.PlayerInteraction.SetPreviousInteraction ( )

Cycles backward to the previous available interaction for the active Hotspot or inventory item.

◆ StopMovingToHotspot()

void AC.PlayerInteraction.StopMovingToHotspot ( )

Cancels the interaction process, that involves the Player prefab moving towards the Hotspot before the Interaction itself is run.

◆ UpdateInteraction()

void AC.PlayerInteraction.UpdateInteraction ( )

Updates the interaction handler. This is called every frame by StateHandler.

◆ UpdateInventory()

void AC.PlayerInteraction.UpdateInventory ( )

De-selects the current inventory item, if appropriate. This is called every frame by StateHandler.

◆ UseHotspot()

void AC.PlayerInteraction.UseHotspot ( Hotspot  _hotspot,
int  selectedCursorID = -1 
)

Runs a Hotspot's 'use' interaction.

Parameters
_hotspotThe Hotspot to use
selectedCursorIDThe ID number of the current cursor. If -1, the Hotspot's first available 'use' interaction will be triggered

◆ UseInventoryOnHotspot()

void AC.PlayerInteraction.UseInventoryOnHotspot ( Hotspot  _hotspot,
int  inventoryItemID,
bool  requireCarry = true 
)

Runs a Hotspot's 'use inventory' interaction.

Parameters
_hotspotThe Hotspot to examine
inventoryItemIDThe ID number of the inventory item (see InvItem)
requireCarryIf the SettingsManager's interactionMethod is CustomScript, the item must be carried by the player for the interaction to trigger

Property Documentation

◆ MovingToHotspotLabel

string AC.PlayerInteraction.MovingToHotspotLabel
get

The Hotspot label while the player is moving towards a Hotspot in order to run an interaction