Class MobRangedAttackTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.MobRangedAttackTask
- All Implemented Interfaces:
PriorityTask
,Task
Task that allows mobs to shoot projectiles or melee attack towers
-
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.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the current priority of the task.void
start()
Starts the task running, triggers the initial "idleStart" event.void
stop()
For stopping the attack taskvoid
update()
The update method is what is run every time the TaskRunner in the AiTaskComponent calls update().void
Mob state machine.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
MobRangedAttackTask
public MobRangedAttackTask(int priority, float maxRange) - Parameters:
priority
- Task priority when targets are detected (0 when nothing detected). Must be a positive integer.maxRange
- Maximum effective range of the weapon mob. This determines the detection distance of targets
-
-
Method Details
-
start
public void start()Starts the task running, triggers the initial "idleStart" event.- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()The update method is what is run every time the TaskRunner in the AiTaskComponent calls update(). Triggers events depending on the presence or otherwise of targets in the detection range- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
updateMobState
public void updateMobState()Mob state machine. Updates mob state by scanning for towers, and triggers the appropriate events corresponding to the STATE enum. -
stop
public void stop()For stopping the attack task- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()Returns the current priority of the task.- Specified by:
getPriority
in interfacePriorityTask
- Returns:
- active priority value if targets detected, inactive priority otherwise
-