Class CompanionInventoryComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.Companion.CompanionInventoryComponent
CompanionInventoryComponent handles all the inventory management for the companion.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPowerup
(Entity item) Adds a power-up item to the companion's inventory if there is space remaining.int
getPowerupCount
(PowerupType type) boolean
Retrieves and uses the next power-up from the companion's inventory, regardless of its type.Methods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
CompanionInventoryComponent
public CompanionInventoryComponent()
-
-
Method Details
-
getPowerupCount
-
addPowerup
Adds a power-up item to the companion's inventory if there is space remaining.- Parameters:
item
- An entity representing the power-up to be added.
-
useNextPowerup
public boolean useNextPowerup()Retrieves and uses the next power-up from the companion's inventory, regardless of its type.- Returns:
- True if a power-up was successfully used, false if the inventory is empty.
-