Adventure Creator 1.84.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2024
Loading...
Searching...
No Matches
AC.InvInstance Class Reference

Public Member Functions

 InvInstance (InvInstance invInstance)
 A Constructor that copies values of another class instance.
 InvInstance (ContainerItem containerItem)
 A Constructor based on a Container item.
 InvInstance (int _itemID, int _count=1)
 A Constructor based on the linked InvItem's ID.
 InvInstance (string _itemName, int _count=1)
 A Constructor based on the linked InvItem's name.
 InvInstance (InvItem _invItem, int _count=1)
 A Constructor based on the linked InvItem.
 InvInstance (int _itemID, int _count, string propertyData, string disabledInteractionData, string disabledCombineIndices, string _sceneItemRememberData)
 A Constructor based on the linked InvItem's ID.
void Select (SelectItemMode _selectItemMode=SelectItemMode.Use)
void Deselect ()
InvVar GetProperty (int propertyID)
 Gets the local property of the associated item's.
InvVar GetProperty (string propertyName)
 Gets the local property of the associated item's.
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.
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.
void Combine (InvInstance combineInstance, bool allowSelfCombining=false)
 Combines two inventory items.
int GetInventoryDisplayCount ()
bool IsPartialTransfer ()
bool CanStack ()
void AddStack ()
void RemoveStack ()
MatchingInvInteractionData GetMatchingInvInteractionData (bool rebuild)
 Gets data related to what interactions are possible.
int GetNextInteraction (int i)
 Gets the index number of the next relevant use/combine interaction.
void RunDefaultInteraction ()
int GetFirstStandardIcon ()
 Gets the ID of the icon that represents the first-available Standard interaction.
string GetFullLabel (int languageNumber=0)
 Gets the items's display name, with prefix.
string GetLabelPrefix (int languageNumber=0, int cursorID=-1)
 Gets the prefix for the Hotspot label (the label without the interactive Hotspot or inventory item)
int GetPreviousInteraction (int i)
 Gets the index number of the previous relevant use/combine interaction.
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 ".
void SetInteractionState (int ID, bool state, bool useCursorID=false)
 Enables or disables a Standard Interaction of the associated item.
void SetCombineInteractionState (int ID, bool state, bool useItemID=false)
 Enables or disables a Combine Interaction of the associated item.
bool HasCursorIcon ()
 If True, the inventory item has a graphic that can be used by the cursor when selected.
bool IsMatch (InvInstance invInstance, bool checkProperties)
 Checks if the InvInstance represents the same inventory item as another.
void ResetProperties ()
SceneItem SpawnInScene (bool reduceCount=false, bool applyRememberData=true)
 Instantiates the item's Linked Prefab into the scene, and creates a link between the two by adding a SceneItem comopnent if it doesn't have one.
SceneItem GetLinkedSceneItem ()

Static Public Member Functions

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

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]
bool TreatOverridesAsSeparate [get, set]
Texture Tex [get, set]
Texture ActiveTex [get, set]
Texture SelectedTex [get, set]
string ItemLabel [get, set]
string SceneItemRememberData [get, set]

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,
string _sceneItemRememberData )

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.
_sceneItemRememberDataA backup of its associated SceneItem's Remember component data.

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()

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

◆ HasCursorIcon()

bool AC.InvInstance.HasCursorIcon ( )

If True, the inventory item has a graphic that can be used by the cursor when selected.

Returns
True if the inventory item has a graphic that can be used by the cursor when selected.

◆ IsMatch()

bool AC.InvInstance.IsMatch ( InvInstance invInstance,
bool checkProperties )

Checks if the InvInstance represents the same inventory item as another.

Parameters
invInstanceThe other InvInstance to compare
checkPropertiesIf True, then the two InvInstance classes must have the same property values for the result to return True
Returns
True if both InvInstances represent the same inventory item

◆ 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()

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.

◆ ResetProperties()

void AC.InvInstance.ResetProperties ( )

Resets the item instance's properties to their original values

◆ 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

◆ SpawnInScene()

SceneItem AC.InvInstance.SpawnInScene ( bool reduceCount = false,
bool applyRememberData = true )

Instantiates the item's Linked Prefab into the scene, and creates a link between the two by adding a SceneItem comopnent if it doesn't have one.

Parameters
reduceCountIf True, and this object can represent multiple instances of the same item, the instantiated object will only represent a single instance, and that instance will be removed from the object
applyRememberDataIf True, any backedup Remember data associated with the SceneItem and its children will be applied
Returns
The instantiated object that represents the item in the scene.

◆ 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

◆ ActiveTex

Texture AC.InvInstance.ActiveTex
getset

The item's 'highlighted' graphic. Setting this will override the default. To have this be considered a separate same item to its original, set TreatOverridesAsSeparate to True.

◆ 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

◆ ItemLabel

string AC.InvInstance.ItemLabel
getset

The inventory item's label, in the current language. Setting this will override the default. To have this be considered a separate same item to its original, set TreatOverridesAsSeparate to True.

◆ 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

◆ SceneItemRememberData

string AC.InvInstance.SceneItemRememberData
getset

A backup of its associated SceneItem's Remember component data

◆ SelectedTex

Texture AC.InvInstance.SelectedTex
getset

The item's 'selected' graphic (if SettingsManager's selectInventoryDisplay = SelectInventoryDisplay.ShowSelectedGraphic). Setting this will override the default. To have this be considered a separate same item to its original, set TreatOverridesAsSeparate to True.

◆ SelectItemMode

SelectItemMode AC.InvInstance.SelectItemMode
getset

The item selection mode

◆ Tex

Texture AC.InvInstance.Tex
getset

The item's main graphic. Setting this will override the default. To have this be considered a separate same item to its original, set TreatOverridesAsSeparate to True.

◆ 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

◆ TreatOverridesAsSeparate

bool AC.InvInstance.TreatOverridesAsSeparate
getset

If True, then the InvInstance will be considered different to other InvInstances of the same item if the Textures or Label has been overridden by setting its Tex, OverrideTex, SelectedTex or ItemLabel properties