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

Public Member Functions

void UpdateInteraction ()
 
void UpdateInteractionLabel ()
 
void UpdateInventory ()
 
void SetActiveHotspot (Hotspot _hotspot)
 Sets the active Hotspot, provided that the chosen hotspot detection method in Settings Manager is CustomScript. More...
 
void PreAutoCycle ()
 
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, InvInstance invInstance, bool requireCarry=true)
 Runs a Hotspot's 'use inventory' interaction. 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...
 
void SetNextInteraction ()
 
void SetPreviousInteraction ()
 
void ResetInteractionIndex ()
 
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 ()
 
void IgnoreInputThisFrame ()
 

Protected Member Functions

void OnEnable ()
 
void OnDisable ()
 
void HandleInteractionMenu ()
 
Hotspot CheckForHotspots ()
 
Hotspot CheckHotspotValid (Hotspot hotspot)
 
bool CanDoDoubleTap ()
 
void ChooseHotspotThenInteractionClick ()
 
void ChooseHotspotThenInteractionClick_Process (bool doubleTap)
 
bool IsInvokingDefaultInteraction ()
 
void ContextSensitiveClick ()
 
void ContextSensitiveClick_Process (bool doubleTap, Hotspot newHotspot)
 
void HandleInteraction ()
 
void ClickHotspotToWalk (Marker walkToMarker)
 
void ClickButton (InteractionType _interactionType, int selectedCursorID, InvInstance selectedInvInstance=null, Hotspot clickedHotspot=null)
 
IEnumerator UseObject (InvInstance selectedInvInstance)
 
void RunUnhandledHotspotInteraction (ActionListAsset _actionListAsset, Hotspot _hotspot, bool optionValue)
 
void StopInteraction ()
 
void OffsetInteraction (bool goForward)
 
void ClickHotspotToInteract (Hotspot _hotspot)
 
string GetInteractionLabel (int _language)
 
virtual bool UnityUIBlocksClick ()
 
void OnInitialiseScene ()
 
void OnInventoryInteract (InvItem invItem, int iconID)
 
void OnInventoryCombine (InvItem invItem1, InvItem invItem2)
 
void OnEnterGameState (GameState gameState)
 
void OnUseInventory ()
 

Protected Attributes

bool inPreInteractionCutscene = false
 
string interactionLabel
 
Hotspot hotspotMovingTo
 
Hotspot hotspot
 
Hotspot lastHotspot = null
 
Button button = null
 
int interactionIndex = -1
 
Hotspot manualHotspot
 
string movingToHotspotLabel = ""
 
bool ignoreInputThisFrame = false
 
int lastClickedCursorID
 
LayerMask hotspotLayerMask
 

Properties

int InteractionIndex [get, set]
 
string MovingToHotspotLabel [get]
 
bool InPreInteractionCutscene [get]
 
string InteractionLabel [get]
 
LayerMask HotspotLayerMask [get, set]
 

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

◆ 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

◆ 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

◆ IgnoreInputThisFrame()

void AC.PlayerInteraction.IgnoreInputThisFrame ( )

Causes all input to be ignored until the next update loop

◆ 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.

◆ 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

◆ 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.

◆ UpdateInteractionLabel()

void AC.PlayerInteraction.UpdateInteractionLabel ( )

Updates the internal 'Hotspot label' according to what, if any, Hotspot is currently selected, and the currently-selected icon or inventory item.

◆ 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,
InvInstance  invInstance,
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

◆ InPreInteractionCutscene

bool AC.PlayerInteraction.InPreInteractionCutscene
get

Checks if the Player is currently walking to a Hotspot in order to run an Interaction, and doing blocks gameplay.

◆ InteractionIndex

int AC.PlayerInteraction.InteractionIndex
getset

The global interaction index.

◆ InteractionLabel

string AC.PlayerInteraction.InteractionLabel
get

The internal 'Hotspot label' according to what, if any, Hotspot is currently selected, and the currently-selected icon or inventory item. Note that this does not account for 'label overrides', such as when accessing a menu

◆ MovingToHotspotLabel

string AC.PlayerInteraction.MovingToHotspotLabel
get

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