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

Public Member Functions

void Interact ()
 
void Add (int _id, int amount)
 Adds an inventory item to the Container's contents. More...
 
void Add (InvInstance addInstance)
 Adds an inventory item to the Container's contents. More...
 
void Remove (int itemID, int amount)
 
void Remove (InvInstance invInstance)
 
void Remove (int itemID)
 
void RemoveAll ()
 Removes all inventory items from the Container's contents. More...
 
int GetCount (int invID)
 Gets the number of instances of a particular inventory item stored within the Container. More...
 
void InsertAt (InvInstance itemInstance, int index, int amountOverride=0)
 Adds an inventory item to the Container's contents, at a particular index. More...
 
int GetInventoryReferences (int invID)
 

Public Attributes

List< ContainerItemitems = new List<ContainerItem>()
 
bool limitToCategory
 
List< int > categoryIDs = new List<int>()
 
int maxSlots = 0
 
bool swapIfFull = false
 

Protected Member Functions

void Awake ()
 
void OnEnable ()
 
void Start ()
 
void OnDisable ()
 
void CreateDefaultInstances ()
 

Protected Attributes

InvCollection invCollection = new InvCollection ()
 

Properties

int Count [get]
 
int FilledSlots [get]
 
InvCollection InvCollection [get, set]
 
bool IsFull [get]
 

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() [1/2]

void 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

◆ Add() [2/2]

void AC.Container.Add ( InvInstance  addInstance)

Adds an inventory item to the Container's contents.

Parameters
addInstanceThe instance of the InvItem to add

◆ GetCount()

int AC.Container.GetCount ( int  invID)

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

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

◆ InsertAt()

void AC.Container.InsertAt ( InvInstance  itemInstance,
int  index,
int  amountOverride = 0 
)

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

Parameters
itemInstanceThe instance of the item 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

◆ 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.

◆ RemoveAll()

void AC.Container.RemoveAll ( )

Removes all inventory items from the Container's contents.

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

◆ limitToCategory

bool AC.Container.limitToCategory

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

◆ maxSlots

int AC.Container.maxSlots = 0

If > 0, the maximum number of item slots the Container can hold

◆ swapIfFull

bool AC.Container.swapIfFull = false

If True, and maxSlots > 0, then attempting to place an item in the Container when full will result in the item being swapped with that in the occupied slot

Property Documentation

◆ Count

int AC.Container.Count
get

The total number of items

◆ FilledSlots

int AC.Container.FilledSlots
get

The total number of filled slots