Class BombChaseTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.BombChaseTask
- All Implemented Interfaces:
PriorityTask
,Task
Task that makes an entity chase a target until either the target is too far away or the line of sight
is lost. Designed specifically for flying bomber enemies that should maintain a hover height above the
target and stop chasing when the target enters a bomb-drop zone.
-
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
ConstructorsConstructorDescriptionBombChaseTask
(Entity target, int priority, float viewDistance, float maxChaseDistance, float hoverHeight, float dropRange, float minHeight) Creates a chase task for a bomber-style enemy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Activate the chase task for light triggered activationvoid
int
Get current priority of the task.void
start()
Initialise and starts a movement task toward the chase target then triggers the chaseStart event.void
stop()
Stop the taskvoid
update()
Update the chase target each frame based on current position and hover rules.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
BombChaseTask
public BombChaseTask(Entity target, int priority, float viewDistance, float maxChaseDistance, float hoverHeight, float dropRange, float minHeight) Creates a chase task for a bomber-style enemy.- Parameters:
target
- the entity to chasepriority
- task priority when chasingviewDistance
- maximum distance at which chasing can start (when inactive)maxChaseDistance
- maximum distance before chasing stopshoverHeight
- preferred vertical offset to maintain above the targetdropRange
- horizontal range within which the target is considered in the bomb-drop zoneminHeight
- minimum vertical difference (drone above target) to qualify for the drop zone
-
-
Method Details
-
activate
public void activate()Activate the chase task for light triggered activation -
deactivate
public void deactivate() -
start
public void start()Initialise and starts a movement task toward the chase target then triggers the chaseStart event.- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Update the chase target each frame based on current position and hover rules.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
stop
public void stop()Stop the task- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()Get current priority of the task. If target is within bomb-drop zone, -1, to allow bombing task to start.- Specified by:
getPriority
in interfacePriorityTask
-