Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
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 UseHotspot (Hotspot _hotspot, Button _button)
 
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 (MouseState mouseState)
 
Hotspot CheckForHotspots ()
 
Hotspot CheckHotspotValid (Hotspot hotspot)
 
bool RequireTwoTaps ()
 
void ChooseHotspotThenInteractionClick (MouseState mouseState)
 
void ChooseHotspotThenInteractionClick_Process (MouseState mouseState, bool doubleTap)
 
bool IsInvokingDefaultInteraction ()
 
void ContextSensitiveClick (MouseState mouseState)
 
void CustomScriptMethod ()
 
void ContextSensitiveClick_Process (MouseState mouseState, bool doubleTap, Hotspot newHotspot)
 
void HandleInteraction (MouseState mouseState)
 
void ClickHotspotToWalk (Marker walkToMarker)
 
void ClickButton (InteractionType _interactionType, int selectedCursorID, InvInstance selectedInvInstance=null, Hotspot clickedHotspot=null)
 
void UseObject (InvInstance selectedInvInstance, Button _button)
 
IEnumerator UseObjectCo (Hotspot _hotspot, Button _button, bool doRun, bool doSnap, InvInstance selectedInvInstance)
 
void RunUnhandledHotspotInteraction (ActionListAsset _actionListAsset, Hotspot _hotspot, bool optionValue)
 
void StopInteraction ()
 
void OffsetInteraction (bool goForward)
 
void ClickHotspotToInteract (Hotspot _hotspot)
 
void UpdateInteractionLabel (int _language)
 
virtual bool UnityUIBlocksClick ()
 
void OnInitialiseScene ()
 
void OnInventoryInteract (InvItem invItem, int iconID)
 
void OnInventoryCombine (InvItem invItem1, InvItem invItem2)
 
void OnEnterGameState (GameState gameState)
 
void OnCharacterRecalculatePathfind (Char character, ref Vector3 destination)
 
void OnUseInventory ()
 

Protected Attributes

bool inPreInteractionCutscene = false
 
HotspotLabelData hotspotLabelData = new HotspotLabelData ()
 
Hotspot hotspotMovingTo
 
Hotspot hotspot
 
Button button
 
Hotspot lastHotspot = null
 
int interactionIndex = -1
 
Hotspot manualHotspot
 
string movingToHotspotLabel = ""
 
bool ignoreInputThisFrame = false
 
int lastClickedCursorID
 
LayerMask hotspotLayerMask
 

Properties

int InteractionIndex [get, set]
 
string MovingToHotspotLabel [get]
 
HotspotLabelData HotspotLabelData [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

◆ HotspotLabelData

HotspotLabelData AC.PlayerInteraction.HotspotLabelData
get

The HotspotLabelData class set from either the active Hotspot, or the selected Inventory item

◆ 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