Class Inventory
A household's inventory. Can store items.
Namespace: Backend
Assembly: cs.temp.dll.dll
Syntax
public class Inventory : HouseholdAssetConstructors
Inventory()
Creates an empty inventory.
Declaration
public Inventory()Methods
AddItem(string)
Adds newItem to the inventory. If it already exists, increment its count.
Declaration
public void AddItem(string newItem)Parameters
| Type | Name | Description | 
|---|---|---|
| string | newItem | The item to add. | 
Contains(string)
Check if item is in the inventory.
Declaration
public bool Contains(string item)Parameters
| Type | Name | Description | 
|---|---|---|
| string | item | The item to look for. | 
Returns
| Type | Description | 
|---|---|
| bool | Whether the item is in the inventory. | 
GetAmount(string)
Gets the count of item in the inventory.
Declaration
public int GetAmount(string item)Parameters
| Type | Name | Description | 
|---|---|---|
| string | item | Item to count. | 
Returns
| Type | Description | 
|---|---|
| int | Count of item in inventory, 0 if none. | 
RemoveItem(string)
Removes one item from the inventory. If it exists, decrement its count. If its count becomes 0, remove the key entry.
If it doesn't exist, log a message in the Unity console.
Declaration
public void RemoveItem(string item)Parameters
| Type | Name | Description | 
|---|---|---|
| string | item | The item to remove. |