Class RobotAttackTask

All Implemented Interfaces:
PriorityTask, Task

public class RobotAttackTask extends RobotTargetDetectionTasks
Allows an entity to attack the closest target entity from a list of potential targets. This task runs when there is a visible target within the entities range of attack
  • Constructor Details

    • RobotAttackTask

      public RobotAttackTask(float attackRange, short targetLayer)
      Creates an attack task
      Parameters:
      attackRange - the maximum distance the entity can find a target to attack
  • Method Details

    • start

      public void start()
      Starts the attack task. The closest visible target within the entity's attack range is found and ATTACK LOGIC BEGINS.
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      Updates the task each game frame
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • stop

      public void stop()
      Stops the attack
      Specified by:
      stop in interface Task
      Overrides:
      stop in class DefaultTask