Class RobotAttackTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.RobotTargetDetectionTasks
com.csse3200.game.components.tasks.RobotAttackTask
- All Implemented Interfaces:
PriorityTask
,Task
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
-
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.components.tasks.RobotTargetDetectionTasks
attackRange, debugRenderer, hit, physics, targetLayer
Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
ConstructorsConstructorDescriptionRobotAttackTask
(float attackRange, short targetLayer) Creates an attack task -
Method Summary
Methods inherited from class com.csse3200.game.components.tasks.RobotTargetDetectionTasks
getDistanceToTarget, getNearestVisibleTarget, getPriority
Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
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 interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Updates the task each game frame- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
stop
public void stop()Stops the attack- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-