Adventure Creator  1.68.4
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.Container Class Reference
Inheritance diagram for AC.Container:

Public Member Functions

void Interact ()
 
bool Add (int _id, int amount)
 Adds an inventory item to the Container's contents. More...
 
void Remove (int _id, int amount)
 Removes an inventory item from the Container's contents. More...
 
void RemoveAll ()
 Removes all inventory items from the Container's contents.
 
int GetCount (int _id)
 Gets the number of instances of a particular inventory item stored within the Container. More...
 
ContainerItem InsertAt (InvItem _item, int _index, int count=0)
 Adds an inventory item to the Container's contents, at a particular index. More...
 
int [] GetIDArray ()
 
int GetInventoryReferences (int invID)
 

Public Attributes

List< ContainerItemitems = new List<ContainerItem>()
 
bool limitToCategory
 
List< int > categoryIDs = new List<int>()
 

Detailed Description

This component that is used to store a local set of inventory items within a scene. The items stored here are separate to those held by the player, who can retrieve or place items in here for safe-keeping.

Member Function Documentation

◆ Add()

bool AC.Container.Add ( int  _id,
int  amount 
)

Adds an inventory item to the Container's contents.

Parameters
_idThe ID number of the InvItem to add
amountHow many instances of the inventory item to add
Returns
True if the addition was succesful

◆ GetCount()

int AC.Container.GetCount ( int  _id)

Gets the number of instances of a particular inventory item stored within the Container.

Parameters
_idThe ID number of the InvItem to search for
Returns
The number of instances of the inventory item stored within the Container

◆ GetIDArray()

int [] AC.Container.GetIDArray ( )

<summmary>Gets an array of ID numbers of existing ContainerItem classes, so that a unique number can be generated.

Returns
Gets an array of ID numbers of existing ContainerItem classes

◆ InsertAt()

ContainerItem AC.Container.InsertAt ( InvItem  _item,
int  _index,
int  count = 0 
)

Adds an inventory item to the Container's contents, at a particular index.

Parameters
_itemThe InvItem to place within the Container
_indexThe index number within the Container's current contents to insert the new item
countIf >0, the quantity of the item to be added. Otherwise, the same quantity as _item will be added
Returns
The ContainerItem instance of the added item

◆ Interact()

void AC.Container.Interact ( )

Activates the Container. If a Menu with an appearType = AppearType.OnContainer, it will be enabled and show the Container's contents.

◆ Remove()

void AC.Container.Remove ( int  _id,
int  amount 
)

Removes an inventory item from the Container's contents.

Parameters
_idThe ID number of the InvItem to remove
amountHow many instances of the inventory item to remove

Member Data Documentation

◆ categoryIDs

List<int> AC.Container.categoryIDs = new List<int>()

The category IDs to limit the display of inventory items by, if limitToCategory = True

◆ items

List<ContainerItem> AC.Container.items = new List<ContainerItem>()

The list of inventory items held by the Container

◆ limitToCategory

bool AC.Container.limitToCategory

If True, only inventory items (InvItem) with a specific category will be displayed