Class PauseTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.ChaseTask
com.csse3200.game.components.tasks.PauseTask
- All Implemented Interfaces:
PriorityTask
,Task
Pauses near a target entity until they move too far away or out of sight.
Extends the ChaseTask to include pausing behavior when in proximity to a target.
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the priority level of the pause behavior.void
start()
Starts the pause behaviorvoid
stop()
Stops the pause behaviorprotected void
Triggers an event to start the pause behavior.protected void
Triggers an event to end the pause behavior.void
update()
Updates the pause behavior by checking the distance to the target entity and determining whether to approach, pause, or end the pause state.Methods inherited from class com.csse3200.game.components.tasks.ChaseTask
getDistanceToTarget, getViewDistance, isBoss, isTargetVisible
Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus, setOwner
-
Constructor Details
-
PauseTask
public PauseTask(Entity target, int priority, float viewDistance, float maxPauseDistance, boolean isBoss) Constructs a new PauseTask that will pause near a target entity.- Parameters:
target
- The entity to pause when seen.priority
- Task priority when pausing (0 when not pausing).viewDistance
- Maximum distance from the entity at which pausing can start.maxPauseDistance
- Maximum distance from the entity to pause.
-
-
Method Details
-
start
public void start()Starts the pause behavior -
triggerPauseEvent
protected void triggerPauseEvent()Triggers an event to start the pause behavior. If the entity has a config component, it fetches the dialogue or hint text associated with the entity to provide context for the pause event. -
triggerPauseEventEnd
protected void triggerPauseEventEnd()Triggers an event to end the pause behavior. -
update
public void update()Updates the pause behavior by checking the distance to the target entity and determining whether to approach, pause, or end the pause state. -
stop
public void stop()Stops the pause behavior -
getPriority
public int getPriority()Returns the priority level of the pause behavior. Determines the priority based on whether the task is currently active or inactive.- Specified by:
getPriority
in interfacePriorityTask
- Overrides:
getPriority
in classChaseTask
- Returns:
- the priority level of the pause behavior.
-