Class WorkerInventoryComponent

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.worker.components.WorkerInventoryComponent
Direct Known Subclasses:
ResourceStatsComponent

public class WorkerInventoryComponent extends Component
A component intended to be used by the player to track their unit's inventory. Currently only stores the stone and metal amount but can be extended for more advanced functionality such as storing other items. Can also be used as a more generic component for other entities.
  • Constructor Details

    • WorkerInventoryComponent

      public WorkerInventoryComponent()
    • WorkerInventoryComponent

      public WorkerInventoryComponent(int stone, int metal, int wood)
  • Method Details

    • getStone

      public int getStone()
      Returns the amount of stone in the inventory
      Returns:
      amount of the stone
    • getMetal

      public int getMetal()
      Returns the amount of metal in the inventory
      Returns:
      amount of the metal
    • getWood

      public int getWood()
      Returns the amount of wood in the inventory
      Returns:
      amount of the wood
    • hasStone

      public Boolean hasStone(int stone)
      Returns if the entity has a certain amount of stone.
      Parameters:
      stone - required amount of stone
      Returns:
      player has greater than or equal to the required amount of stone
    • hasMetal

      public Boolean hasMetal(int metal)
      Returns if the entity has a certain amount of metal.
      Parameters:
      metal - required amount of metal
      Returns:
      player has greater than or equal to the required amount of metal
    • hasWood

      public Boolean hasWood(int wood)
      Returns if the entity has a certain amount of wood.
      Parameters:
      wood - required amount of wood
      Returns:
      player has greater than or equal to the required amount of wood
    • setStone

      public void setStone(int stone)
      Sets the player's stone. Stone has a minimum bound of 0.
      Parameters:
      stone - stone
    • setMetal

      public void setMetal(int metal)
      Sets the player's metal. Metal has a minimum bound of 0.
      Parameters:
      metal - metal
    • setWood

      public void setWood(int wood)
      Sets the player's wood. Wood h
      Parameters:
      wood -
    • addStone

      public void addStone(int stone)
      Adds to the player's stone. The amount added can be negative.
      Parameters:
      stone - stone to add
    • addMetal

      public void addMetal(int metal)
      Adds to the player's metal. The amount added can be negative.
      Parameters:
      metal - metal to add
    • addWood

      public void addWood(int wood)
      Adds to the player's wood. The amount added can be negative.
      Parameters:
      wood - wood to add
    • unloadStone

      public int unloadStone()
    • unloadMetal

      public int unloadMetal()
    • unloadWood

      public int unloadWood()