Class AddToInventoryComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.player.AddToInventoryComponent
When this entity touches a valid objects's hitbox, the item dissappears and is added to the inventory hashmap
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionAddToInventoryComponent(short targetLayer) Create a component which is added to the player entities on collisionAddToInventoryComponent(short targetLayer, int id) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToInventory(int inventoryCount, InventoryComponent playerInventory, com.badlogic.gdx.physics.box2d.Fixture me) Deprecated.voidcreate()Called when the entity is created and registered.voiddispose()Called when the component is disposed.voidMethods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
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:ComponentCalled 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. -
dispose
public void dispose()Description copied from class:ComponentCalled when the component is disposed. Dispose of any internal resources here. -
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 inventoryplayerInventory- the players inventoryme- the player
-
showInventoryFull
public void showInventoryFull()
-