Class MobRangedAttackTask

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

public class MobRangedAttackTask extends DefaultTask implements PriorityTask
Task that allows mobs to shoot projectiles or melee attack towers
  • Constructor Details

    • MobRangedAttackTask

      public MobRangedAttackTask(int priority, float maxRange)
      Parameters:
      priority - Task priority when targets are detected (0 when nothing detected). Must be a positive integer.
      maxRange - Maximum effective range of the weapon mob. This determines the detection distance of targets
  • Method Details

    • start

      public void start()
      Starts the task running, triggers the initial "idleStart" event.
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      The update method is what is run every time the TaskRunner in the AiTaskComponent calls update(). Triggers events depending on the presence or otherwise of targets in the detection range
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • updateMobState

      public void updateMobState()
      Mob state machine. Updates mob state by scanning for towers, and triggers the appropriate events corresponding to the STATE enum.
    • stop

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

      public int getPriority()
      Returns the current priority of the task.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      active priority value if targets detected, inactive priority otherwise