This class will manage all the inventory related operations.
More...
|
void | AddItem (InventoryLocation inventoryLocation, Item item) |
| Add an item to the inventory List for the inventory location More...
|
|
void | AddItem (InventoryLocation inventoryLocation, Item item, GameObject gameObjectToDelete) |
| Add an item to the inventory list for the inventoryLocation and then destroy the gameObjectToDelete More...
|
|
void | SwapInventoryItems (InventoryLocation inventoryLocation, int fromItem, int toItem) |
| Swap item at fromItem index with item at toItem index in inventoryLocation inventory list. More...
|
|
void | ClearSelectedInventoryItem (InventoryLocation inventoryLocation) |
| Clear the selected inventory item for inventory Location. More...
|
|
int | FindItemInInventory (InventoryLocation inventoryLocation, int itemCode) |
| Find if an itemCode is already in the inventory. Returns the item position in the inventory list, or -1 if the item is not in the inventory More...
|
|
ItemDetails | GetItemDetails (int itemCode) |
| Returns the itemDetails (from the SOItemList) for the itemCode, or null if the item code doesn't exist. More...
|
|
ItemDetails | GetSelectedInventoryItemDetails (InventoryLocation inventoryLocation) |
| Returns the item details (From the So_ItemList) of the currently selected item. More...
|
|
string | GetItemTypeDescription (ItemType itemType) |
| Return the desctiption of the item type. More...
|
|
void | RemoveItem (InventoryLocation inventoryLocation, int itemCode) |
| Remove an item from the inventory, and create a gameobject at the position it was dropped More...
|
|
void | SetSelectedInventoryItem (InventoryLocation inventoryLocation, int itemCode) |
| Set the selected inventory item for inventoryLocation to itemCode More...
|
|
|
override void | Awake () |
| Create item details dictionary Keep the original awake function in Singleton class and the override it to initialize item dictionary. This will gurantee that dictionary will initialize before we used that in other classes. More...
|
|
virtual void | Awake () |
|
This class will manage all the inventory related operations.
Definition at line 7 of file InventoryManager.cs.
◆ AddItem() [1/2]
Add an item to the inventory List for the inventory location
- Parameters
-
Definition at line 90 of file InventoryManager.cs.
◆ AddItem() [2/2]
void InventoryManager.AddItem |
( |
InventoryLocation |
inventoryLocation, |
|
|
Item |
item, |
|
|
GameObject |
gameObjectToDelete |
|
) |
| |
|
inline |
Add an item to the inventory list for the inventoryLocation and then destroy the gameObjectToDelete
- Parameters
-
inventoryLocation | |
item | |
gameObjectToDelete | |
Definition at line 117 of file InventoryManager.cs.
◆ AddItemAtPosition() [1/2]
void InventoryManager.AddItemAtPosition |
( |
List< InventoryItem > |
inventoryList, |
|
|
int |
itemCode |
|
) |
| |
|
inlineprivate |
◆ AddItemAtPosition() [2/2]
void InventoryManager.AddItemAtPosition |
( |
List< InventoryItem > |
inventoryList, |
|
|
int |
itemCode, |
|
|
int |
position |
|
) |
| |
|
inlineprivate |
◆ Awake()
override void InventoryManager.Awake |
( |
| ) |
|
|
inlineprotectedvirtual |
Create item details dictionary Keep the original awake function in Singleton class and the override it to initialize item dictionary. This will gurantee that dictionary will initialize before we used that in other classes.
Reimplemented from SingletonMonobehaviour< InventoryManager >.
Definition at line 32 of file InventoryManager.cs.
◆ ClearSelectedInventoryItem()
void InventoryManager.ClearSelectedInventoryItem |
( |
InventoryLocation |
inventoryLocation | ) |
|
|
inline |
◆ CreateInventoryLists()
void InventoryManager.CreateInventoryLists |
( |
| ) |
|
|
inlineprivate |
◆ CreateItemDetailsDictionary()
void InventoryManager.CreateItemDetailsDictionary |
( |
| ) |
|
|
inlineprivate |
Populates the itemDetailsDictionary from scriptable object item list.
Definition at line 75 of file InventoryManager.cs.
◆ FindItemInInventory()
int InventoryManager.FindItemInInventory |
( |
InventoryLocation |
inventoryLocation, |
|
|
int |
itemCode |
|
) |
| |
|
inline |
Find if an itemCode is already in the inventory. Returns the item position in the inventory list, or -1 if the item is not in the inventory
- Parameters
-
inventoryLocation | |
itemCode | |
- Returns
Definition at line 193 of file InventoryManager.cs.
◆ GetItemDetails()
ItemDetails InventoryManager.GetItemDetails |
( |
int |
itemCode | ) |
|
|
inline |
Returns the itemDetails (from the SOItemList) for the itemCode, or null if the item code doesn't exist.
- Parameters
-
- Returns
Definition at line 213 of file InventoryManager.cs.
◆ GetItemTypeDescription()
string InventoryManager.GetItemTypeDescription |
( |
ItemType |
itemType | ) |
|
|
inline |
Return the desctiption of the item type.
- Parameters
-
- Returns
Definition at line 258 of file InventoryManager.cs.
◆ GetSelectedInventoryItem()
Get the selected item for inventoryLocation
- Returns
- itemCode or -1 if not fount.
Definition at line 248 of file InventoryManager.cs.
◆ GetSelectedInventoryItemDetails()
Returns the item details (From the So_ItemList) of the currently selected item.
- Parameters
-
- Returns
- itemDetails or null if there is no item
Definition at line 230 of file InventoryManager.cs.
◆ RemoveItem()
void InventoryManager.RemoveItem |
( |
InventoryLocation |
inventoryLocation, |
|
|
int |
itemCode |
|
) |
| |
|
inline |
Remove an item from the inventory, and create a gameobject at the position it was dropped
Definition at line 299 of file InventoryManager.cs.
◆ RemoveItemAtPosition()
void InventoryManager.RemoveItemAtPosition |
( |
List< InventoryItem > |
inventoryList, |
|
|
int |
itemCode, |
|
|
int |
position |
|
) |
| |
|
inlineprivate |
Remove an item from a specific position
- Parameters
-
inventoryList | |
itemCode | |
position | |
Definition at line 321 of file InventoryManager.cs.
◆ SetSelectedInventoryItem()
void InventoryManager.SetSelectedInventoryItem |
( |
InventoryLocation |
inventoryLocation, |
|
|
int |
itemCode |
|
) |
| |
|
inline |
Set the selected inventory item for inventoryLocation to itemCode
- Parameters
-
inventoryLocation | |
itemCode | |
Definition at line 344 of file InventoryManager.cs.
◆ SwapInventoryItems()
void InventoryManager.SwapInventoryItems |
( |
InventoryLocation |
inventoryLocation, |
|
|
int |
fromItem, |
|
|
int |
toItem |
|
) |
| |
|
inline |
Swap item at fromItem index with item at toItem index in inventoryLocation inventory list.
- Parameters
-
inventoryLocation | |
fromItem | |
toItem | |
Definition at line 161 of file InventoryManager.cs.
◆ m_InventoryListCapacityIntArray
int [] InventoryManager.m_InventoryListCapacityIntArray |
The index of the array is the inventory list (From the inventory location enum), and the value is the capacity of that inventory list.
Definition at line 21 of file InventoryManager.cs.
◆ m_InventoryLists
We have two inventory lists, one for player and other for chest. index 0 is for player.
Definition at line 16 of file InventoryManager.cs.
◆ m_ItemDetailsDictionary
Dictionary<int, ItemDetails> InventoryManager.m_ItemDetailsDictionary |
|
private |
◆ m_ItemList
◆ m_SelectedInventoryItem
int [] InventoryManager.m_SelectedInventoryItem |
|
private |
The index of the array is the inventory list, and the value is the item code.
Definition at line 12 of file InventoryManager.cs.
The documentation for this class was generated from the following file: