java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.ChaseTask
com.csse3200.game.minigames.maze.components.tasks.MazeChaseTask
All Implemented Interfaces:
PriorityTask, Task

public class MazeChaseTask extends ChaseTask
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.
  • Constructor Details

    • MazeChaseTask

      public MazeChaseTask(Entity target, int priority, float viewDistance, float maxChaseDistance)
      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

    • start

      public void start()
      Starts chasing the target
      Specified by:
      start in interface Task
      Overrides:
      start in class ChaseTask
    • update

      public void update()
      Updates the chasers position, target and animation
      Specified by:
      update in interface Task
      Overrides:
      update in class ChaseTask
    • getDistanceToTarget

      protected float getDistanceToTarget()
      Get the distance from this entity to the entity being chased
      Overrides:
      getDistanceToTarget in class ChaseTask
      Returns:
      the distance
    • isTargetVisible

      protected boolean isTargetVisible()
      Determines if the target is visible for the current entity (around walls etc.)
      Overrides:
      isTargetVisible in class ChaseTask
      Returns:
      true if visible, else false