Class DefaultTask

java.lang.Object
com.deco2800.game.ai.tasks.DefaultTask
All Implemented Interfaces:
Task
Direct Known Subclasses:
ChaseTask, DeadTask, JumpTask, MovementTask, ProjectileTask, TransportTask, WaitTask, WanderTask

public abstract class DefaultTask extends Object implements Task
A default task implementation that stores the associated entity and updates status when starting/stopping a task. Removes some boilerplate code from each task.
  • Field Details

  • Constructor Details

    • DefaultTask

      public DefaultTask()
  • Method Details

    • create

      public void create(TaskRunner taskRunner)
      Description copied from interface: Task
      Create the task and attach it to the task runner.
      Specified by:
      create in interface Task
      Parameters:
      taskRunner - Task runner to attach to
    • start

      public void start()
      Description copied from interface: Task
      Start running this task. This will usually be called by an AI controller.
      Specified by:
      start in interface Task
    • update

      public void update()
      Description copied from interface: Task
      Run one frame of the task. Similar to the update() in Components.
      Specified by:
      update in interface Task
    • stop

      public void stop()
      Description copied from interface: Task
      Stop the task immediately. This can be called at any time by the AI controller.
      Specified by:
      stop in interface Task
    • getStatus

      public Task.Status getStatus()
      Description copied from interface: Task
      Get the current status of the task.
      Specified by:
      getStatus in interface Task
      Returns:
      status