Class InventoryComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.inventory.InventoryComponent
Data class to store the player's inventory separately from the display components.
All other objects which do not explicitly need to use the display but need to access the
inventory should access this component only.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.Returns the player's current inventory from this attached InventoryComponent.void
Loads the inventory attached to the player from a save.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
InventoryComponent
public InventoryComponent(int capacity)
-
-
Method Details
-
create
public void create()Description copied from class:Component
Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. -
getInventory
Returns the player's current inventory from this attached InventoryComponent.- Returns:
- The player's current inventory.
-
loadInventoryFromSave
public void loadInventoryFromSave()Loads the inventory attached to the player from a save.
-