Class MobShootTask

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

public class MobShootTask extends DefaultTask implements PriorityTask
Task that allows mobs to shoot projectiles or melee attack towers
  • 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
    MobShootTask(int priority, float maxRange)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the current priority of the task.
    void
    Starts the task running, triggers the initial "idleStart" event.
    void
    For stopping the attack task
    void
    The update method is what is run every time the TaskRunner in the AiTaskComponent calls update().
    void
    Mob state machine.

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

    create, getStatus

    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
  • Constructor Details

    • MobShootTask

      public MobShootTask(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