Class InventorySystem
This handles the inventory of our character. The inventory has a maximum of 32 slot, each slot can hold one TYPE of object, but those can be stacked without limit (e.g. 1 slot used by health potions, but contains 20 health potions)
Inheritance
System.Object
InventorySystem
Namespace: CreatorKitCode
Assembly: Assembly-CSharp.dll
Syntax
public class InventorySystem
Fields
Entries
Declaration
public InventorySystem.InventoryEntry[] Entries
Field Value
Type | Description |
---|---|
InventorySystem.InventoryEntry[] |
Methods
AddItem(Item)
Add an item to the inventory. This will look if this item already exist in one of the slot and increment the stack counter there instead of using another slot.
Declaration
public void AddItem(Item item)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item to add to the inventory |
Init(CharacterData)
Declaration
public void Init(CharacterData owner)
Parameters
Type | Name | Description |
---|---|---|
CharacterData | owner |
UseItem(InventorySystem.InventoryEntry)
This will try to use the item. If the item return true when used, this will decrement the stack count and if the stack count reach 0 this will free the slot. If it return false, it will just ignore that call. (e.g. a potion will return false if the user is at full health, not consuming the potion in that case)
Declaration
public bool UseItem(InventorySystem.InventoryEntry item)
Parameters
Type | Name | Description |
---|---|---|
InventorySystem.InventoryEntry | item |
Returns
Type | Description |
---|---|
System.Boolean |