Class CompanionInventoryComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.Companion.CompanionInventoryComponent

public class CompanionInventoryComponent extends Component
CompanionInventoryComponent handles all the inventory management for the companion.
  • Constructor Details

    • CompanionInventoryComponent

      public CompanionInventoryComponent()
  • Method Details

    • getPowerupCount

      public int getPowerupCount(PowerupType type)
    • addPowerup

      public void addPowerup(Entity item)
      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.