Class AddToInventoryComponent

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.player.AddToInventoryComponent

public class AddToInventoryComponent extends Component
When this entity touches a valid objects's hitbox, the item dissappears and is added to the inventory hashmap
  • Constructor Details

    • AddToInventoryComponent

      public AddToInventoryComponent(short targetLayer)
      Create a component which is added to the player entities on collision
      Parameters:
      targetLayer - The physics layer of the target's collider.
    • AddToInventoryComponent

      public AddToInventoryComponent(short targetLayer, int id)
  • 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.
      Overrides:
      create in class Component
    • dispose

      public void dispose()
      Description copied from class: Component
      Called when the component is disposed. Dispose of any internal resources here.
      Overrides:
      dispose in class Component
    • addToInventory

      @Deprecated public void addToInventory(int inventoryCount, InventoryComponent playerInventory, com.badlogic.gdx.physics.box2d.Fixture me)
      Deprecated.
      Determine if object can be added to the inventory
      Parameters:
      inventoryCount - the count of the inventory
      playerInventory - the players inventory
      me - the player
    • showInventoryFull

      public void showInventoryFull()