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 a bomber chase and position itself optimally above a target when detected by its cone light.
  • 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 maxChaseDistance, float optimalHeight, float heightTolerance)
    Creates a chase task for a bomber that uses cone light detection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Activates the chase task.
    void
    Create the task and attach it to the task runner.
    void
    Deactivates the chase task.
    int
    Get current priority of the task.
    boolean
    Check if the chase task has acquired a target via cone light detection.
    void
    Initialise and starts movement toward the chase target.
    void
    Stop the task
    void
    Update the chase, positioning bomber at optimal height above target.

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

    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

    getStatus
  • Constructor Details

    • BombChaseTask

      public BombChaseTask(Entity target, int priority, float maxChaseDistance, float optimalHeight, float heightTolerance)
      Creates a chase task for a bomber that uses cone light detection.
      Parameters:
      target - the entity to chase
      priority - task priority when chasing
      maxChaseDistance - maximum distance before chasing stops
      optimalHeight - optimal height to maintain above target for bombing
      heightTolerance - tolerance for height positioning
  • Method Details

    • create

      public void create(TaskRunner owner)
      Description copied from interface: Task
      Create the task and attach it to the task runner.
      Specified by:
      create in interface Task
      Overrides:
      create in class DefaultTask
      Parameters:
      owner - Task runner to attach to
    • activate

      public void activate()
      Activates the chase task. The priority will be raised, allowing the task to run.
    • deactivate

      public void deactivate()
      Deactivates the chase task. The priority will be set to -1, stopping the task.
    • start

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

      public void update()
      Update the chase, positioning bomber at optimal height above target.
      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. Priority system: - Returns priority when cone light has detected target - Returns lower priority (5) when searching for lost target - Returns -1 if target too far or at correct position for bombing
      Specified by:
      getPriority in interface PriorityTask
    • hasTarget

      public boolean hasTarget()
      Check if the chase task has acquired a target via cone light detection.
      Returns:
      true if target acquired, false otherwise