Class BossChaseTask

java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.BossChaseTask
All Implemented Interfaces:
PriorityTask, Task

public class BossChaseTask extends DefaultTask implements PriorityTask
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)
  • Constructor Details

    • BossChaseTask

      public BossChaseTask(Entity player, com.badlogic.gdx.math.Vector2 stopPoint)
      Construct the boss chase task
      Parameters:
      player - the player entity to chase
      stopPoint - 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:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • 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:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • stop

      public void stop()
      Stops the task and its movement subtask. Emits a "bossChaseEnd" event.
      Specified by:
      stop in interface Task
      Overrides:
      stop in class DefaultTask
    • getPriority

      public int getPriority()
      Returns the current scheduling priority.
      Specified by:
      getPriority in interface PriorityTask
      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)