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.
- Attaches listeners once the camera exists
- Re-links automatically if the camera instance changes (e.g. after reset)
-
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, getPrio, 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.
-