Class rangedAttackTask
java.lang.Object
com.deco2800.game.ai.tasks.DefaultTask
com.deco2800.game.components.tasks.rangedAttackTask
- All Implemented Interfaces:
PriorityTask
,Task
Attacks a target entity when it gets close to the enemy.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.deco2800.game.ai.tasks.Task
Task.Status
-
Field Summary
Fields inherited from class com.deco2800.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
ConstructorsConstructorDescriptionrangedAttackTask
(Entity target, float waitTime, int priority, float distance) -
Method Summary
Methods inherited from class com.deco2800.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
rangedAttackTask
- Parameters:
target
- The entity to attack.waitTime
- The waiting time between each attack.priority
- Task priority when chasing (0 when not chasing).distance
- The attack distance. Construct the AttackTask.
-
-
Method Details
-
start
public void start()Description copied from interface:Task
Start running this task. This will usually be called by an AI controller.- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Description copied from interface:Task
Run one frame of the task. Similar to the update() in Components.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
stop
public void stop()Description copied from interface:Task
Stop the task immediately. This can be called at any time by the AI controller.- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfacePriorityTask
-