Class ActivationComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.enemy.ActivationComponent

public class ActivationComponent extends Component
This component links an enemy to a security camera by ID. When the camera detects/loses the target, it triggers "enemyActivated"/"enemyDeactivated" on the owner entity. If the camera isn't spawned yet, the component retries linking in update().
  • Constructor Details

    • ActivationComponent

      public ActivationComponent(String cameraId)
      Create an ActivationComponent for a specific camera
      Parameters:
      cameraId - Unique camera identified to link to to (e.g. "1")
  • Method Details

    • create

      public void create()
      Attempts to link immediately. Retries in update() if camera isn't ready (no spawn race).
      Overrides:
      create in class Component
    • update

      public void update()
      Retries linking if unsuccessful during create().
      Overrides:
      update in class Component
    • dispose

      public void dispose()
      Clean up.
      Overrides:
      dispose in class Component
    • isLinked

      public boolean isLinked()
      Getter to check camera is linked to entity
      Returns:
      true if linked, otherwise false.