Class MazeChaseTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.ChaseTask
com.csse3200.game.minigames.maze.components.tasks.MazeChaseTask
- All Implemented Interfaces:
PriorityTask
,Task
Chases a target entity until they get too far away or line of sight is lost.
Differs from the main game ChaseTask in that all movement is relative to the center
of both the entity this is attached to and the entity being chased.
-
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.components.tasks.ChaseTask
debugRenderer, hit, maxChaseDistance, movementTask, physics, priority, target, viewDistance
Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
ConstructorsConstructorDescriptionMazeChaseTask
(Entity target, int priority, float viewDistance, float maxChaseDistance) -
Method Summary
Modifier and TypeMethodDescriptionprotected float
Get the distance from this entity to the entity being chasedprotected boolean
Determines if the target is visible for the current entity (around walls etc.)void
start()
Starts chasing the targetvoid
update()
Updates the chasers position, target and animationMethods inherited from class com.csse3200.game.components.tasks.ChaseTask
getPriority, getViewDistance, isBoss, stop
Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus, setOwner
-
Constructor Details
-
MazeChaseTask
- 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.
-
-
Method Details
-
start
public void start()Starts chasing the target -
update
public void update()Updates the chasers position, target and animation -
getDistanceToTarget
protected float getDistanceToTarget()Get the distance from this entity to the entity being chased- Overrides:
getDistanceToTarget
in classChaseTask
- Returns:
- the distance
-
isTargetVisible
protected boolean isTargetVisible()Determines if the target is visible for the current entity (around walls etc.)- Overrides:
isTargetVisible
in classChaseTask
- Returns:
- true if visible, else false
-