Manages the player's inventory system, storing and organizing equippable items.
More...
|
| | Inventory (Player player, int size) |
| | Initializes a new instance of the Inventory class.
|
| |
| bool | AddToInventory (IEquippable item) |
| | Adds an item to the inventory at the selected index if empty, otherwise finds the nearest empty slot.
|
| |
| IEquippable? | GetSelectedItem () |
| | Gets the currently selected item without removing it.
|
| |
| IEquippable? | GetNItem (int n) |
| | Gets the nth item in the inventory without removing it.
|
| |
| int | GetCount () |
| | Gets the current number of items in the inventory.
|
| |
| bool | TakeToRight () |
| | Equips the selected item in the inventory to the player's right hand and removes it from inventory.
|
| |
| bool | TakeToLeft () |
| | Equips the selected item in the inventory to the player's left hand and removes it from inventory.
|
| |
|
|
int | SelectedIndex = 0 [get, set] |
| | The currently selected inventory slot index (0-9).
|
| |
|
int | Size [get] |
| | Gets the maximum size of the inventory.
|
| |
Manages the player's inventory system, storing and organizing equippable items.
The inventory has a fixed capacity and maintains a LIFO (Last In, First Out) structure. Items are added to the inventory and can be equipped directly to either hand.
◆ Inventory()
| RpgGame.Core.Inventory.Inventory |
( |
Player |
player, |
|
|
int |
size |
|
) |
| |
|
inline |
Initializes a new instance of the Inventory class.
- Parameters
-
| player | The player who owns the inventory. |
| size | The maximum capacity of the inventory (ignored, forced to 10). |
◆ AddToInventory()
| bool RpgGame.Core.Inventory.AddToInventory |
( |
IEquippable |
item | ) |
|
|
inline |
Adds an item to the inventory at the selected index if empty, otherwise finds the nearest empty slot.
- Parameters
-
| item | The equippable item to add. |
- Returns
- True if the item was successfully added; false if the inventory is full.
◆ GetCount()
| int RpgGame.Core.Inventory.GetCount |
( |
| ) |
|
|
inline |
Gets the current number of items in the inventory.
- Returns
- The number of items currently stored in the inventory.
◆ GetNItem()
Gets the nth item in the inventory without removing it.
- Parameters
-
| n | The 0-based index of the item to retrieve. |
- Returns
- The nth item in the inventory, or null if n is out of bounds or slot is empty.
◆ GetSelectedItem()
| IEquippable? RpgGame.Core.Inventory.GetSelectedItem |
( |
| ) |
|
|
inline |
Gets the currently selected item without removing it.
- Returns
- The selected item, or null if the slot is empty.
◆ TakeToLeft()
| bool RpgGame.Core.Inventory.TakeToLeft |
( |
| ) |
|
|
inline |
Equips the selected item in the inventory to the player's left hand and removes it from inventory.
- Returns
- True if an item was successfully equipped; false if the slot is empty or equip failed.
◆ TakeToRight()
| bool RpgGame.Core.Inventory.TakeToRight |
( |
| ) |
|
|
inline |
Equips the selected item in the inventory to the player's right hand and removes it from inventory.
- Returns
- True if an item was successfully equipped; false if the slot is empty or equip failed.
The documentation for this class was generated from the following file: