Class RobotTargetDetectionTasks

java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.RobotTargetDetectionTasks
All Implemented Interfaces:
PriorityTask, Task
Direct Known Subclasses:
RobotAttackTask

public abstract class RobotTargetDetectionTasks extends DefaultTask implements PriorityTask
  • Field Details

    • attackRange

      protected final float attackRange
    • physics

      protected final PhysicsEngine physics
    • debugRenderer

      protected final DebugRenderer debugRenderer
    • hit

      protected final RaycastHit hit
    • targetLayer

      protected short targetLayer
  • Constructor Details

    • RobotTargetDetectionTasks

      protected RobotTargetDetectionTasks(float attackRange, short targetLayer)
  • Method Details

    • getDistanceToTarget

      protected float getDistanceToTarget()
      Gets the distance to the nearest visible target
      Returns:
      the distance to the nearest target or a MAX VALUE if there is no target
    • getPriority

      public int getPriority()
      Determines the tasks priority
      • When active: returns 1 if target is in range and visible, otherwise -1.
      • When inactive: returns 1 if target is in range and visible, otherwise -1.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      the tasks priority
    • getNearestVisibleTarget

      protected Entity getNearestVisibleTarget()
      Finds the nearest visible target within attack range.
      Returns:
      the closest visible target within range, or null if none