Class BombDropTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.BombDropTask
- All Implemented Interfaces:
PriorityTask,Task
Task that makes drone drop bombs when the bomber's cone light detects a target below.
Works in conjunction with ConeDetectorComponent for detection.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.csse3200.game.ai.tasks.Task
Task.Status -
Field Summary
Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status -
Constructor Summary
ConstructorsConstructorDescriptionBombDropTask(Entity target, int priority, float cooldown, float optimalHeight, float heightTolerance) Create a bomb dropping task that works with light detection. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(TaskRunner owner) Create the task and attach it to the task runner.intComputes scheduling priority based on light detection and positioning.booleanCheck if target is currently detected.voidstart()Start drone attack and trigger a dropStart event on owner entityvoidstop()Stop attack taskvoidupdate()Advance attack sequence when attackingMethods inherited from class com.csse3200.game.ai.tasks.DefaultTask
getStatus
-
Constructor Details
-
BombDropTask
public BombDropTask(Entity target, int priority, float cooldown, float optimalHeight, float heightTolerance) Create a bomb dropping task that works with light detection.- Parameters:
target- player or other entity to attackpriority- priority of taskcooldown- min time between consecutive drops in secondsoptimalHeight- optimal height above target for dropping bombsheightTolerance- tolerance for height positioning
-
-
Method Details
-
create
Description copied from interface:TaskCreate the task and attach it to the task runner.- Specified by:
createin interfaceTask- Overrides:
createin classDefaultTask- Parameters:
owner- Task runner to attach to
-
getPriority
public int getPriority()Computes scheduling priority based on light detection and positioning.- Specified by:
getPriorityin interfacePriorityTask- Returns:
- priority of the task
-
start
public void start()Start drone attack and trigger a dropStart event on owner entity- Specified by:
startin interfaceTask- Overrides:
startin classDefaultTask
-
update
public void update()Advance attack sequence when attacking- Specified by:
updatein interfaceTask- Overrides:
updatein classDefaultTask
-
stop
public void stop()Stop attack task- Specified by:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
isTargetDetected
public boolean isTargetDetected()Check if target is currently detected.- Returns:
- true if target is detected
-