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

Public Member Functions

void UpdateInteraction ()
 
void UpdateInventory ()
 
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 ClickButton (InteractionType _interactionType, int selectedCursorID, int selectedItemID, Hotspot clickedHotspot=null)
 Handles the clicking of a Hotspot, and runs the appropriate interaction based on the current cursor and inventory. 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)
 
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 ()
 

Public Attributes

bool inPreInteractionCutscene = false
 

Detailed Description

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

Member Function Documentation

void AC.PlayerInteraction.ClickButton ( InteractionType  _interactionType,
int  selectedCursorID,
int  selectedItemID,
Hotspot  clickedHotspot = null 
)

Handles the clicking of a Hotspot, and runs the appropriate interaction based on the current cursor and inventory.

Parameters
_interactionTypeThe type of interaction to run (Use, Examine, Inventory)
selectedCursorIDThe ID number of the current cursor, if _interactionType = InteractionType.Use
selectedItemIDThe ID number of the current inventory item (see InvItem), if _interactionType = InteractionType.Inventory
clickedHotspotThe Hotspot that was clicked on
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
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
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
Hotspot AC.PlayerInteraction.GetActiveHotspot ( )

Gets the active Hotspot.

Returns
The active Hotspot
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.
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.
Hotspot AC.PlayerInteraction.GetHotspotMovingTo ( )

Gets the Hotspot that the Player is moving towards.

Returns
The Hotspot that the Player is moving towards
Vector2 AC.PlayerInteraction.GetHotspotScreenCentre ( )

Gets the centre of the active Hotspot in screen space

Returns
The centre of the active Hotspot in screen space
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
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")
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
Hotspot AC.PlayerInteraction.GetLastOrActiveHotspot ( )

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

Returns
The last Hotspot to be active
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
bool AC.PlayerInteraction.IsMouseOverHotspot ( )

Checks if the cursor is currently over a Hotspot.

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

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.

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.

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
void AC.PlayerInteraction.SetNextInteraction ( )

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

void AC.PlayerInteraction.SetPreviousInteraction ( )

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

void AC.PlayerInteraction.StopMovingToHotspot ( )

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

void AC.PlayerInteraction.UpdateInteraction ( )

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

void AC.PlayerInteraction.UpdateInventory ( )

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

Member Data Documentation

bool AC.PlayerInteraction.inPreInteractionCutscene = false

If True, then gameplay is blocked because the Player prefab is moving towards a Hotspot before the Interaction is run