Class ConeDetectorComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.lighting.ConeDetectorComponent

public class ConeDetectorComponent extends Component
Component that is responsible for detecting if a target entity is within the light cone. It also detects whether the target entity is hidden behind another entity with a specified physics layer.
  • Constructor Details

    • ConeDetectorComponent

      public ConeDetectorComponent(Entity target, String id)
      Constructor for the ConeDetector. The occluder mask is set to "PhysicsLayer.OBSTACLE" by default.
      Parameters:
      target - the target entity to be detected
    • ConeDetectorComponent

      public ConeDetectorComponent(Entity target, short occluderMask, String id)
  • Method Details

    • setDebug

      public ConeDetectorComponent setDebug(boolean enabled)
    • setOccluderMask

      public ConeDetectorComponent setOccluderMask(short mask)
    • getTarget

      public Entity getTarget()
    • 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
    • update

      public void update()
      Description copied from class: Component
      Called once per frame of the game, and should be used for most component logic. Not called if component is disabled.
      Overrides:
      update in class Component
    • isDetected

      public boolean isDetected()