Class SelfDestructOnHitComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.SelfDestructOnHitComponent

public class SelfDestructOnHitComponent extends Component
This specific entity will self-destruct after the collisionEnd event if the targetLayer matches. Possible extensions to take in an array of entities instead.
  • Constructor Details

    • SelfDestructOnHitComponent

      public SelfDestructOnHitComponent(short targetLayer)
      Create a component that self-destructs based on a specified targetLayer.
      Parameters:
      targetLayer - Physic's layer of the target collider.
  • 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