![]() |
Platformer Pro
2.3.2
A platform game kit for Unity.
|
Stores data baout an inventory. More...
Public Member Functions | |
InventoryData () | |
Initializes a new instance of the PlatformerPro.InventoryData class. More... | |
InventoryData (int size) | |
Initializes a new instance of the PlatformerPro.InventoryData class. More... | |
int[] | FindStacks (string itemId) |
Finds the stacks for a given item. More... | |
int | ItemCount (string itemId) |
Gets the count of a given item type across all stacks. More... | |
int | GetAmountAtStack (int position) |
Gets the amount in the given stack position. More... | |
ItemInstanceData | GetItemAtStack (int position) |
Gets the data at the given stack position. More... | |
int | FirstEmptySlot () |
Finds the first empty slot. More... | |
void | AddToEmptyStack (string typeId, int position, int amount) |
Adds new items to a stack at the given position. More... | |
void | AddToEmptyStack (ItemInstanceData data, int index) |
Adds new items to a stack at the given position. More... | |
void | AddToStack (int position, string itemId, int amount) |
Adds items to an existing stack at given position. More... | |
void | RemoveFromStack (int position, int amount) |
Removes items from a stack at given position. More... | |
void | SwitchPositions (int indexA, int indexB) |
Switches the positions of items unless items are stacks of same type it which case it tries to merge the stacks. More... | |
bool | CleanUpGaps () |
Shifts positions of items such that there are no gaps in the inventory. More... | |
void | ClearStack (int position) |
Remvoed items from a stack at given position. More... | |
Public Attributes | |
ItemInstanceData[] | itemData |
Protected Attributes | |
List< int > | stackCache |
Used to calcualte results. More... | |
Stores data baout an inventory.
PlatformerPro.InventoryData.InventoryData | ( | ) |
Initializes a new instance of the PlatformerPro.InventoryData class.
PlatformerPro.InventoryData.InventoryData | ( | int | size | ) |
Initializes a new instance of the PlatformerPro.InventoryData class.
size | Size. |
void PlatformerPro.InventoryData.AddToEmptyStack | ( | ItemInstanceData | data, |
int | index | ||
) |
Adds new items to a stack at the given position.
typeId | Item Type ID. |
position | Slot to fill. |
amount | Amount. |
void PlatformerPro.InventoryData.AddToEmptyStack | ( | string | typeId, |
int | position, | ||
int | amount | ||
) |
Adds new items to a stack at the given position.
typeId | Item Type ID. |
position | Slot to fill. |
amount | Amount. |
void PlatformerPro.InventoryData.AddToStack | ( | int | position, |
string | itemId, | ||
int | amount | ||
) |
Adds items to an existing stack at given position.
position | Slot to fill. |
amount | Amount. |
bool PlatformerPro.InventoryData.CleanUpGaps | ( | ) |
Shifts positions of items such that there are no gaps in the inventory.
void PlatformerPro.InventoryData.ClearStack | ( | int | position | ) |
Remvoed items from a stack at given position.
position | Slot to fill. |
amount | Amount. |
int [] PlatformerPro.InventoryData.FindStacks | ( | string | itemId | ) |
Finds the stacks for a given item.
itemId | Item identifier. |
int PlatformerPro.InventoryData.FirstEmptySlot | ( | ) |
Finds the first empty slot.
int PlatformerPro.InventoryData.GetAmountAtStack | ( | int | position | ) |
Gets the amount in the given stack position.
position | Position. |
ItemInstanceData PlatformerPro.InventoryData.GetItemAtStack | ( | int | position | ) |
Gets the data at the given stack position.
position | Position. |
int PlatformerPro.InventoryData.ItemCount | ( | string | itemId | ) |
Gets the count of a given item type across all stacks.
itemId | Item identifier. |
void PlatformerPro.InventoryData.RemoveFromStack | ( | int | position, |
int | amount | ||
) |
Removes items from a stack at given position.
position | Slot to fill. |
amount | Amount. |
void PlatformerPro.InventoryData.SwitchPositions | ( | int | indexA, |
int | indexB | ||
) |
Switches the positions of items unless items are stacks of same type it which case it tries to merge the stacks.
indexA | Index a. |
indexB | Index b. |
ItemInstanceData [] PlatformerPro.InventoryData.itemData |
|
protected |
Used to calcualte results.