Class ChaseTask
java.lang.Object
com.deco2800.game.ai.tasks.DefaultTask
com.deco2800.game.components.tasks.ChaseTask
- All Implemented Interfaces:
PriorityTask,Task
Chases a target entity until they get too far away or line of sight is lost
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.deco2800.game.ai.tasks.Task
Task.Status -
Field Summary
Fields inherited from class com.deco2800.game.ai.tasks.DefaultTask
owner, status -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.deco2800.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
ChaseTask
- Parameters:
target- The entity to chase.priority- Task priority when chasing (0 when not chasing).viewDistance- Maximum distance from the entity at which chasing can start.maxChaseDistance- Maximum distance from the entity while chasing before giving up.
-
ChaseTask
public ChaseTask(Entity target, int priority, float viewDistance, float maxChaseDistance, float speed) - Parameters:
target- The entity to chase.priority- Task priority when chasing (0 when not chasing).viewDistance- Maximum distance from the entity at which chasing can start.maxChaseDistance- Maximum distance from the entity while chasing before giving up.speed- The speed to chase at.
-
-
Method Details
-
start
public void start()Start chase task.- Specified by:
startin interfaceTask- Overrides:
startin classDefaultTask
-
update
public void update()Update chase task.- Specified by:
updatein interfaceTask- Overrides:
updatein classDefaultTask
-
stop
public void stop()Stop this task.- Specified by:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
getPriority
public int getPriority()Get the priority of this task.- Specified by:
getPriorityin interfacePriorityTask- Returns:
- integer representing the priority of this task.
-