Class ChaseTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.ChaseTask
- All Implemented Interfaces:
PriorityTask
,Task
- Direct Known Subclasses:
AvoidTask
,MazeChaseTask
,PauseTask
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.csse3200.game.ai.tasks.Task
Task.Status
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DebugRenderer
protected final RaycastHit
protected final float
protected MovementTask
protected final PhysicsEngine
protected final int
protected final Entity
protected final float
Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected float
int
float
boolean
isBoss()
protected boolean
void
start()
Moves the entity in the direction of the entities target (often the player)void
stop()
Stop the task immediately.void
update()
Updates the direction in which the entity needs to move in, checks every frame to see where the player is to determine this.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus, setOwner
-
Field Details
-
target
-
priority
protected final int priority -
viewDistance
protected final float viewDistance -
maxChaseDistance
protected final float maxChaseDistance -
physics
-
debugRenderer
-
hit
-
movementTask
-
-
Constructor Details
-
ChaseTask
public ChaseTask(Entity target, int priority, float viewDistance, float maxChaseDistance, com.badlogic.gdx.math.Vector2 speed, boolean isBoss) - 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
-
isBoss
public boolean isBoss() -
start
public void start()Moves the entity in the direction of the entities target (often the player)- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Updates the direction in which the entity needs to move in, checks every frame to see where the player is to determine this.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
getViewDistance
public float getViewDistance() -
stop
public void stop()Description copied from interface:Task
Stop the task immediately. This can be called at any time by the AI controller.- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfacePriorityTask
-
getDistanceToTarget
protected float getDistanceToTarget() -
isTargetVisible
protected boolean isTargetVisible()
-