Class MobAttackTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.MobAttackTask
- 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the current priority of the task.voidstart()Starts the task running, triggers the initial "idleStart" event.voidstop()For stopping the attack taskvoidupdate()The update method is what is run every time the TaskRunner in the AiTaskComponent calls update().voidMob state machine.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
MobAttackTask
public MobAttackTask(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:
startin interfaceTask- Overrides:
startin 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:
updatein interfaceTask- Overrides:
updatein 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:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
getPriority
public int getPriority()Returns the current priority of the task.- Specified by:
getPriorityin interfacePriorityTask- Returns:
- active priority value if targets detected, inactive priority otherwise
-