Adventure Creator  1.75.4
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2019
AC.InvInstance Class Reference

Public Member Functions

 InvInstance (InvInstance invInstance)
 A Constructor that copies values of another class instance More...
 
 InvInstance (ContainerItem containerItem)
 A Constructor based on a Container item More...
 
 InvInstance (int _itemID, int _count=1)
 A Constructor based on the linked InvItem's ID More...
 
 InvInstance (string _itemName, int _count=1)
 A Constructor based on the linked InvItem's name More...
 
 InvInstance (InvItem _invItem, int _count=1)
 A Constructor based on the linked InvItem More...
 
 InvInstance (int _itemID, int _count, string propertyData, string disabledInteractionData, string disabledCombineIndices)
 A Constructor based on the linked InvItem's ID More...
 
void Select (SelectItemMode _selectItemMode=SelectItemMode.Use)
 
void Deselect ()
 
InvVar GetProperty (int propertyID)
 Gets the local property of the associated item's More...
 
InvVar GetProperty (string propertyName)
 Gets the local property of the associated item's More...
 
InvInstance CreateTransferInstance ()
 
void Clear ()
 
void Clear (int amount)
 Removes a given amount of the item from this instance, while ensuring that the OnInventoryRemove event is triggered More...
 
Container GetSourceContainer ()
 
InvCollection GetSource ()
 
void Examine ()
 
void Use (bool selectIfUnhandled=true)
 
void Use (int iconID)
 Runs an inventory item's interaction, when multiple "use" interactions are defined. More...
 
void Combine (InvInstance combineInstance, bool allowSelfCombining=false)
 Combines two inventory items. More...
 
int GetInventoryDisplayCount ()
 
bool IsPartialTransfer ()
 
bool CanStack ()
 
void AddStack ()
 
void RemoveStack ()
 
MatchingInvInteractionData GetMatchingInvInteractionData (bool rebuild)
 Gets data related to what interactions are possible More...
 
int GetNextInteraction (int i)
 Gets the index number of the next relevant use/combine interaction. More...
 
void RunDefaultInteraction ()
 
int GetFirstStandardIcon ()
 Gets the ID of the icon that represents the first-available Standard interaction. More...
 
string GetFullLabel (int languageNumber=0)
 Gets the items's display name, with prefix. More...
 
string GetLabelPrefix (int languageNumber=0, int cursorID=-1)
 Gets the prefix for the Hotspot label (the label without the interactive Hotspot or inventory item) More...
 
int GetPreviousInteraction (int i)
 Gets the index number of the previous relevant use/combine interaction. More...
 
int GetActiveInvButtonID ()
 
void RestoreInteraction ()
 
string GetHotspotPrefixLabel (int languageNumber, bool canGive=false)
 Gets the full prefix to a Hotpsot label when an item is selected, e.g. "Use X on " / "Give X to ". More...
 
void SetInteractionState (int ID, bool state, bool useCursorID=false)
 Enables or disables a Standard Interaction of the associated item More...
 
void SetCombineInteractionState (int ID, bool state, bool useItemID=false)
 Enables or disables a Combine Interaction of the associated item More...
 

Static Public Member Functions

static bool IsValid (InvInstance invInstance)
 Checks if the instance is both non-null, and references an item More...
 
static string GetSaveData (InvInstance invInstance)
 Generates data to save about an item instance in a single string. More...
 

Properties

int? Count [get, set]
 
int? TransferCount [get, set]
 
InvItem InvItem [get]
 
int ItemID [get]
 
CursorIcon CursorIcon [get]
 
int Capacity [get]
 
int LastInteractionIndex [get, set]
 
SelectItemMode SelectItemMode [get, set]
 
ItemStackingMode ItemStackingMode [get]
 
bool CanBeAnimated [get]
 
InvInteraction[] Interactions [get]
 
InvCombineInteraction[] CombineInteractions [get]
 

Detailed Description

A data class for an Inventory item instance. When an item is added to the Player's inventory at runtime, a reference is created to it with this class.

Constructor & Destructor Documentation

◆ InvInstance() [1/6]

AC.InvInstance.InvInstance ( InvInstance  invInstance)

A Constructor that copies values of another class instance

Parameters
invInstanceThe class instance to copy from

◆ InvInstance() [2/6]

AC.InvInstance.InvInstance ( ContainerItem  containerItem)

A Constructor based on a Container item

Parameters
containerItemThe Container item to create an instance from

◆ InvInstance() [3/6]

AC.InvInstance.InvInstance ( int  _itemID,
int  _count = 1 
)

A Constructor based on the linked InvItem's ID

Parameters
_itemIDThe ID number of the associated InvItem
_countThe amount of that item to reference

◆ InvInstance() [4/6]

AC.InvInstance.InvInstance ( string  _itemName,
int  _count = 1 
)

A Constructor based on the linked InvItem's name

Parameters
_itemNameThe name number of the associated InvItem
_countThe amount of that item to reference

◆ InvInstance() [5/6]

AC.InvInstance.InvInstance ( InvItem  _invItem,
int  _count = 1 
)

A Constructor based on the linked InvItem

Parameters
_itemIDThe associated InvItem
_countThe amount of that item to reference

◆ InvInstance() [6/6]

AC.InvInstance.InvInstance ( int  _itemID,
int  _count,
string  propertyData,
string  disabledInteractionData,
string  disabledCombineIndices 
)

A Constructor based on the linked InvItem's ID

Parameters
_itemIDThe ID number of the associated InvItem
_countThe amount of that item to reference
propertyDataSerialized data related to the instance's property data, which will override the default values.
propertyDataSerialized data related to the instance's disabled interaction data, which will override the default values.
propertyDataSerialized data related to the instance's disabled combine data, which will override the default values.

Member Function Documentation

◆ AddStack()

void AC.InvInstance.AddStack ( )

Increases the transfer count by 1, if possible

◆ CanStack()

bool AC.InvInstance.CanStack ( )

Checks if stacking is possible

◆ Clear() [1/2]

void AC.InvInstance.Clear ( )

Removes all counts of the item from this instance, while ensuring that the OnInventoryRemove event is triggered

◆ Clear() [2/2]

void AC.InvInstance.Clear ( int  amount)

Removes a given amount of the item from this instance, while ensuring that the OnInventoryRemove event is triggered

Parameters
amountHow much of the item to remove

◆ Combine()

void AC.InvInstance.Combine ( InvInstance  combineInstance,
bool  allowSelfCombining = false 
)

Combines two inventory items.

Parameters
combineInstanceThe instance of the inventory item to combine
allowSelfCombiningIf True, then an item can be combined with itself

◆ CreateTransferInstance()

InvInstance AC.InvInstance.CreateTransferInstance ( )

Reduces the item instance's own internal amount of associated items, and creates a new one ready to be transferred to another collection

◆ Deselect()

void AC.InvInstance.Deselect ( )

Dselects the associated item, if selected

◆ Examine()

void AC.InvInstance.Examine ( )

Runs an inventory item's "Examine" interaction

◆ GetActiveInvButtonID()

int AC.InvInstance.GetActiveInvButtonID ( )

Gets the ID of the active inventory interaction, or -1 if none is found

◆ GetFirstStandardIcon()

int AC.InvInstance.GetFirstStandardIcon ( )

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

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

◆ GetFullLabel()

string AC.InvInstance.GetFullLabel ( int  languageNumber = 0)

Gets the items's display name, with prefix.

Parameters
languageNumberThe index of the current language, as set in SpeechManager
Returns
The item's display name, with prefix

◆ GetHotspotPrefixLabel()

string AC.InvInstance.GetHotspotPrefixLabel ( int  languageNumber,
bool  canGive = false 
)

Gets the full prefix to a Hotpsot label when an item is selected, e.g. "Use X on " / "Give X to ".

Parameters
invItemThe inventory item that is selected
languageNumberThe index of the current language, as set in SpeechManager
canGiveIf True, the the item is assumed to be in "give" mode, as opposed to "use".
Returns
The full prefix to a Hotspot label when the item is selected

◆ GetInventoryDisplayCount()

int AC.InvInstance.GetInventoryDisplayCount ( )

Gets the amount of instances not being selected/transferred

◆ GetLabelPrefix()

string AC.InvInstance.GetLabelPrefix ( 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

◆ GetMatchingInvInteractionData()

MatchingInvInteractionData AC.InvInstance.GetMatchingInvInteractionData ( bool  rebuild)

Gets data related to what interactions are possible

Parameters
rebuildIf True, the data will be rebuilt before being returned
Returns
Data related to what interactions are possible

◆ GetNextInteraction()

int AC.InvInstance.GetNextInteraction ( int  i)

Gets the index number of the next relevant use/combine interaction.

Parameters
iThe index number to start from

◆ GetPreviousInteraction()

int AC.InvInstance.GetPreviousInteraction ( int  i)

Gets the index number of the previous relevant use/combine interaction.

Parameters
iThe index number to start from

◆ GetProperty() [1/2]

InvVar AC.InvInstance.GetProperty ( int  propertyID)

Gets the local property of the associated item's

Parameters
propertyIDThe ID of the local property to retrieve
Returns
The local property

◆ GetProperty() [2/2]

InvVar AC.InvInstance.GetProperty ( string  propertyName)

Gets the local property of the associated item's

Parameters
propertyNameThe name of the local property to retrieve
Returns
The local property

◆ GetSaveData()

static string AC.InvInstance.GetSaveData ( InvInstance  invInstance)
static

Generates data to save about an item instance in a single string.

Parameters
invInstanceThe inventory item instance to save
Returns
Save data for the instance as a single string

◆ GetSource()

InvCollection AC.InvInstance.GetSource ( )

Gets the collection of item instances that this is a part of

◆ GetSourceContainer()

Container AC.InvInstance.GetSourceContainer ( )

Gets the Container that this item instance is a part of, if it's in one

◆ IsPartialTransfer()

bool AC.InvInstance.IsPartialTransfer ( )

Checks if the item instance is only being partially selected/transferred, in that the number of items being affected is not the same as its total capacity

◆ IsValid()

static bool AC.InvInstance.IsValid ( InvInstance  invInstance)
static

Checks if the instance is both non-null, and references an item

Parameters
invInstanceThe instance to check
Returns
True if the instance is non-null and references an item

◆ RemoveStack()

void AC.InvInstance.RemoveStack ( )

Removes the transfer count by 1. If the transfer count is then 1, and the item is selected, it will be de-selected automatically.

◆ RestoreInteraction()

void AC.InvInstance.RestoreInteraction ( )

Restores the previous interaction state

◆ RunDefaultInteraction()

void AC.InvInstance.RunDefaultInteraction ( )

Runs the item's default 'Use' interactions. This is the first defined 'Standard Interaction' in the item's properties.

◆ Select()

void AC.InvInstance.Select ( SelectItemMode  _selectItemMode = SelectItemMode.Use)

Selects the associated item

◆ SetCombineInteractionState()

void AC.InvInstance.SetCombineInteractionState ( int  ID,
bool  state,
bool  useItemID = false 
)

Enables or disables a Combine Interaction of the associated item

Parameters
IDThe ID of the Combine Interaction to affect
stateIf True, the interaction will be enabled. If False, the interaction will be disabled
  • Parameters
    useCursorIDIf True, then ID becomes the ID of the interaction's associated Inventory Item, and not the ID of the interaction itself

◆ SetInteractionState()

void AC.InvInstance.SetInteractionState ( int  ID,
bool  state,
bool  useCursorID = false 
)

Enables or disables a Standard Interaction of the associated item

Parameters
IDThe ID of the Standard Interaction to affect
stateIf True, the interaction will be enabled. If False, the interaction will be disabled
useCursorIDIf True, then ID becomes the ID of the interaction's associated Cursor Icon, and not the ID of the interaction itself

◆ Use() [1/2]

void AC.InvInstance.Use ( bool  selectIfUnhandled = true)

Runs an inventory item's "Use" interaction

◆ Use() [2/2]

void AC.InvInstance.Use ( int  iconID)

Runs an inventory item's interaction, when multiple "use" interactions are defined.

Parameters
iconIDThe ID number of the interaction's icon, defined in CursorManager

Property Documentation

◆ CanBeAnimated

bool AC.InvInstance.CanBeAnimated
get

Checks if the item's assigned textures are enough for animated effects to be possible.

◆ Capacity

int AC.InvInstance.Capacity
get

How many additional counts of the item can occupy this instance

◆ CombineInteractions

InvCombineInteraction [] AC.InvInstance.CombineInteractions
get

An array of all combine interactions that are currently enabled

◆ Count

int? AC.InvInstance.Count
getset

The amount of the associated item this refers to

◆ CursorIcon

CursorIcon AC.InvInstance.CursorIcon
get

The associated inventory item's Cursor Icon

◆ Interactions

InvInteraction [] AC.InvInstance.Interactions
get

An array of all standard interactions that are currently enabled

◆ InvItem

InvItem AC.InvInstance.InvItem
get

The associated inventory item

◆ ItemID

int AC.InvInstance.ItemID
get

The associated inventory item's ID number

◆ ItemStackingMode

ItemStackingMode AC.InvInstance.ItemStackingMode
get

The item stacking mode

◆ LastInteractionIndex

int AC.InvInstance.LastInteractionIndex
getset

An identifier number of the last Use/Inventory interaction associated with the item

◆ SelectItemMode

SelectItemMode AC.InvInstance.SelectItemMode
getset

The item selection mode

◆ TransferCount

int? AC.InvInstance.TransferCount
getset

The amount of items to transfer. To move only some of the items associated with this instance, set this value and then add the result of CreateTransferInstance to an InvCollection