Class ItemComponent

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.items.ItemComponent

public class ItemComponent
extends Component
  • Field Summary

    Fields inherited from class com.deco2800.game.components.Component

    enabled, entity
  • Constructor Summary

    Constructors 
    Constructor Description
    ItemComponent​(Entity target, java.util.function.Consumer<Entity> callback)
    creates a first aid component that detects when the player collides with the entity and when collided it runs a buff function for the Item
  • Method Summary

    Modifier and Type Method Description
    void create()
    Called when the entity is created and registered.

    Methods inherited from class com.deco2800.game.components.Component

    dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ItemComponent

      public ItemComponent​(Entity target, java.util.function.Consumer<Entity> callback)
      creates a first aid component that detects when the player collides with the entity and when collided it runs a buff function for the Item
      Parameters:
      target - entity on which the buff function will work on
  • 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