Class BossChaseTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.BossChaseTask
- All Implemented Interfaces:
PriorityTask,Task
Boss AI chase behaviour.
- Chases the player until it reaches a specified x threshold (specified by stop point in constructor)
- Once the player escapes, the boss moves to the fixed stop point
- The task deactivates when the boss arrives at the stop point (i.e. it cannot be scheduled by AI task runner)
-
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.ai.tasks.DefaultTask
owner, status -
Constructor Summary
ConstructorsConstructorDescriptionBossChaseTask(Entity player, com.badlogic.gdx.math.Vector2 stopPoint) Construct the boss chase task -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the task, making it eligible for scheduling.voidDeactivates the task, preventing it from being scheduled.com.badlogic.gdx.math.Vector2Get current targetintReturns the current scheduling priority.voidstart()Starts the task.voidstop()Stops the task and its movement subtask.voidupdate()Updates the task each frame.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
BossChaseTask
Construct the boss chase task- Parameters:
player- the player entity to chasestopPoint- the world-space position (stopX, stopY) the boss will move to after the player passes stopX
-
-
Method Details
-
activate
public void activate()Activates the task, making it eligible for scheduling. -
deactivate
public void deactivate()Deactivates the task, preventing it from being scheduled. -
start
public void start()Starts the task. If active, decides whether to begin by chasing the player or going directly to the stop point. Creates and starts the movement subtask. Emits a "bossChaseStart" event.- Specified by:
startin interfaceTask- Overrides:
startin classDefaultTask
-
update
public void update()Updates the task each frame. While the player is left of stopX, chases the player. Once the player is at/past stopX, moves to the stopPoint.- Specified by:
updatein interfaceTask- Overrides:
updatein classDefaultTask
-
stop
public void stop()Stops the task and its movement subtask. Emits a "bossChaseEnd" event.- Specified by:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
getPriority
public int getPriority()Returns the current scheduling priority.- Specified by:
getPriorityin interfacePriorityTask- Returns:
- 10 when active (eligible), otherwise -1.
-
getCurrentTarget
public com.badlogic.gdx.math.Vector2 getCurrentTarget()Get current target- Returns:
- a copy of the current movement target the boss is pursuing (either player position or stop point)
-