Class ActivationComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.enemy.ActivationComponent
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().
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionActivationComponent
(String cameraId) Create an ActivationComponent for a specific camera -
Method Summary
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
ActivationComponent
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). -
update
public void update()Retries linking if unsuccessful during create(). -
dispose
public void dispose()Clean up. -
isLinked
public boolean isLinked()Getter to check camera is linked to entity- Returns:
- true if linked, otherwise false.
-