Class MobDodgeTask

All Implemented Interfaces:
PriorityTask, Task

public class MobDodgeTask extends MobWanderTask
This task runs the AI that adds a dodge mechanic/functionality for the mobs in the MobsFactory. Inherits from the MobWanderTask that handles the death and movement mechanics of the entity.

Relies heavily on the attached DodgingComponent that adds the "dodgeIncomingEntity" event to the attached entity.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.csse3200.game.ai.tasks.Task

    Task.Status
  • Field Summary

    Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask

    owner, status
  • Constructor Summary

    Constructors
    Constructor
    Description
    MobDodgeTask(com.badlogic.gdx.math.Vector2 wanderRange, float waitTime, int priority)
    Initialises a mob dodge task with a specified wander range, wait time, and priority level.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the priority level of this dodge task initialised in the constructor.
    void
    Start running the task.
    void
    Run a frame of the task.

    Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask

    create, getStatus, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.csse3200.game.ai.tasks.Task

    create, getStatus, stop
  • Constructor Details

    • MobDodgeTask

      public MobDodgeTask(com.badlogic.gdx.math.Vector2 wanderRange, float waitTime, int priority)
      Initialises a mob dodge task with a specified wander range, wait time, and priority level.
      Parameters:
      wanderRange - Distance in X and Y the entity can move from its position when start() is called.
      waitTime - How long in seconds to wait between wandering.
      priority - Priority level compared to other added tasks.
  • Method Details

    • start

      public void start()
      Start running the task. Usually called by the AI controller.
      Specified by:
      start in interface Task
      Overrides:
      start in class MobWanderTask
    • update

      public void update()
      Run a frame of the task. In this extension of the update(), the "dodgeIncomingEntity" event will be detected and triggered on set intervals.
      Specified by:
      update in interface Task
      Overrides:
      update in class MobWanderTask
    • getPriority

      public int getPriority()
      Returns the priority level of this dodge task initialised in the constructor.
      Specified by:
      getPriority in interface PriorityTask
      Overrides:
      getPriority in class MobWanderTask