Class FireTowerCombatTask

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

public class FireTowerCombatTask extends DefaultTask implements PriorityTask
The FireTowerCombatTask runs the AI for the FireTower class. The tower implementing this task will scan for enemies in a straight line from the current position to a maxRange, and change the state of the tower.
  • Field Details

  • Constructor Details

    • FireTowerCombatTask

      public FireTowerCombatTask(int priority, float maxRange)
      Starts the task running, triggers the initial 'IDLE' event
  • Method Details

    • start

      public void start()
      starts this task and triggers the IDLE animation
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      this method is called everytime state of the tower needs to be changed.
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • updateTowerState

      public void updateTowerState()
      finite state machine for the FireTower. Detects mobs in a straight line and changes the state of the tower.
    • stop

      public void stop()
      stops the current animation.
      Specified by:
      stop in interface Task
      Overrides:
      stop in class DefaultTask
    • getState

      public FireTowerCombatTask.STATE getState()
      Returns:
      returns the current state of the tower
    • getPriority

      public int getPriority()
      gets the priority for the current task.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      (int) active priority if target is visible and inactive priority otherwise
    • isTargetVisible

      public boolean isTargetVisible()
      detects targets from the centre of the tower to maxRange in a straight line.
      Returns:
      true if mobs are present and false otherwise.
    • getFireRateInterval

      public float getFireRateInterval()
      Function for getting the turret's fire rate.
      Returns:
      The fireRateInterval variable