Class BombChaseTask

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

public class BombChaseTask extends DefaultTask implements PriorityTask
Task that makes an entity chase a target until either the target is too far away or the line of sight is lost. Designed specifically for flying bomber enemies that should maintain a hover height above the target and stop chasing when the target enters a bomb-drop zone.
  • 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
    BombChaseTask(Entity target, int priority, float viewDistance, float maxChaseDistance, float hoverHeight, float dropRange, float minHeight)
    Creates a chase task for a bomber-style enemy.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Activate the chase task for light triggered activation
    void
     
    int
    Get current priority of the task.
    void
    Initialise and starts a movement task toward the chase target then triggers the chaseStart event.
    void
    Stop the task
    void
    Update the chase target each frame based on current position and hover rules.

    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

    • BombChaseTask

      public BombChaseTask(Entity target, int priority, float viewDistance, float maxChaseDistance, float hoverHeight, float dropRange, float minHeight)
      Creates a chase task for a bomber-style enemy.
      Parameters:
      target - the entity to chase
      priority - task priority when chasing
      viewDistance - maximum distance at which chasing can start (when inactive)
      maxChaseDistance - maximum distance before chasing stops
      hoverHeight - preferred vertical offset to maintain above the target
      dropRange - horizontal range within which the target is considered in the bomb-drop zone
      minHeight - minimum vertical difference (drone above target) to qualify for the drop zone
  • Method Details

    • activate

      public void activate()
      Activate the chase task for light triggered activation
    • deactivate

      public void deactivate()
    • start

      public void start()
      Initialise and starts a movement task toward the chase target then triggers the chaseStart event.
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      Update the chase target each frame based on current position and hover rules.
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • stop

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

      public int getPriority()
      Get current priority of the task. If target is within bomb-drop zone, -1, to allow bombing task to start.
      Specified by:
      getPriority in interface PriorityTask