Class BombDropTask

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

public class BombDropTask extends DefaultTask implements PriorityTask
Task that makes drone drop bombs when the bomber's cone light detects a target below. Works in conjunction with ConeDetectorComponent for detection.
  • 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
    BombDropTask(Entity target, int priority, float cooldown, float optimalHeight, float heightTolerance)
    Create a bomb dropping task that works with light detection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Create the task and attach it to the task runner.
    int
    Computes scheduling priority based on light detection and positioning.
    boolean
    Check if target is currently detected.
    void
    Start drone attack and trigger a dropStart event on owner entity
    void
    Stop attack task
    void
    Advance attack sequence when attacking

    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

    • BombDropTask

      public BombDropTask(Entity target, int priority, float cooldown, float optimalHeight, float heightTolerance)
      Create a bomb dropping task that works with light detection.
      Parameters:
      target - player or other entity to attack
      priority - priority of task
      cooldown - min time between consecutive drops in seconds
      optimalHeight - optimal height above target for dropping bombs
      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
    • getPriority

      public int getPriority()
      Computes scheduling priority based on light detection and positioning.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      priority of the task
    • start

      public void start()
      Start drone attack and trigger a dropStart event on owner entity
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      Advance attack sequence when attacking
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • stop

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

      public boolean isTargetDetected()
      Check if target is currently detected.
      Returns:
      true if target is detected