Class BombshipCombatTask

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

public class BombshipCombatTask extends DefaultTask implements PriorityTask
The AI Task for the Engineer entity. The Engineer will scan for targets within its detection range and trigger events to change its state accordingly. This task must be called once the Engineer has appropiately moved into position.
  • Constructor Details

    • BombshipCombatTask

      public BombshipCombatTask(float maxRange)
  • Method Details

    • start

      public void start()
      Runs the task and triggers Bombship's idle animation.
      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
    • updateBombshipState

      public void updateBombshipState()
      Bombship state machine
    • stop

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

      public int getPriority()
      Simplified getPriority function, returns the priority of the task
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      priority as an integer value. If mobs are visible, return the current priority, otherwise return 0.
    • isEngineerDied

      public boolean isEngineerDied()
      Uses a raycast to determine whether there are any targets in detection range. Performs multiple raycasts to a range of points at x = engineer.x + maxRange, and a range of y values above and below current y position. Allows the bombship entity to detect mobs in adjacent lanes.
      Returns:
      true if a target is detected, false otherwise