Class ProjectileMovementTask

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

public class ProjectileMovementTask extends DefaultTask implements PriorityTask
Chases a target entity until they get too far away or line of sight is lost
  • Field Details

    • priority

      protected final int priority
    • physics

      protected final PhysicsEngine physics
  • Constructor Details

    • ProjectileMovementTask

      public ProjectileMovementTask(Entity target, int priority)
      Parameters:
      target - The entity to chase.
      priority - Task priority when chasing (0 when not chasing).
  • Method Details

    • start

      public void start()
      Moves the entity in the direction of the entities target (often the player)
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      Updates the direction in which the entity needs to move in, checks every frame to see where the player is to determine this.
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface PriorityTask
    • getMovementTask

      public MovementTask getMovementTask()
      MovementTask getter
      Returns:
      Movement task of this projectile