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

public class PatrolTask extends DefaultTask implements PriorityTask
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.
  • Field Details

  • 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 interface Task
      Overrides:
      start in class DefaultTask
    • 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 interface Task
      Overrides:
      update in class DefaultTask
    • stop

      public void stop()
      Stops the task
      Specified by:
      stop in interface Task
      Overrides:
      stop in class DefaultTask
    • getPriority

      public int getPriority()
      Gets this tasks interrupt priority
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      the priority