Class PatrolTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.minigames.maze.components.tasks.PatrolTask
- 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
FieldsFields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus, setOwner
-
Field Details
-
movementTask
-
-
Constructor Details
-
PatrolTask
public PatrolTask(int priority, com.badlogic.gdx.math.Vector2[] patrolPoints) - Parameters:
priority
- Task priority when chasing (0 when not chasing).patrolPoints
- Points to patrol between.
-
-
Method Details
-
start
public void start()Starts patrolling- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Updates the target position of the movement task to the current patrol point and updates the patrol point to the next one if close to the current one.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
stop
public void stop()Stops the task- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()Gets this tasks interrupt priority- Specified by:
getPriority
in interfacePriorityTask
- Returns:
- the priority
-