Class MobDodgeTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.MobWanderTask
com.csse3200.game.components.tasks.MobDodgeTask
- All Implemented Interfaces:
PriorityTask
,Task
This task runs the AI that adds a dodge mechanic/functionality for the mobs
in the MobsFactory. Inherits from the MobWanderTask that handles the death
and movement mechanics of the entity.
Relies heavily on the attached DodgingComponent that adds the "dodgeIncomingEntity" event to the attached entity.
-
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
ConstructorDescriptionMobDodgeTask
(com.badlogic.gdx.math.Vector2 wanderRange, float waitTime, int priority) Initialises a mob dodge task with a specified wander range, wait time, and priority level. -
Method Summary
Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus, stop
-
Constructor Details
-
MobDodgeTask
public MobDodgeTask(com.badlogic.gdx.math.Vector2 wanderRange, float waitTime, int priority) Initialises a mob dodge task with a specified wander range, wait time, and priority level.- Parameters:
wanderRange
- Distance in X and Y the entity can move from its position when start() is called.waitTime
- How long in seconds to wait between wandering.priority
- Priority level compared to other added tasks.
-
-
Method Details
-
start
public void start()Start running the task. Usually called by the AI controller.- Specified by:
start
in interfaceTask
- Overrides:
start
in classMobWanderTask
-
update
public void update()Run a frame of the task. In this extension of the update(), the "dodgeIncomingEntity" event will be detected and triggered on set intervals.- Specified by:
update
in interfaceTask
- Overrides:
update
in classMobWanderTask
-
getPriority
public int getPriority()Returns the priority level of this dodge task initialised in the constructor.- Specified by:
getPriority
in interfacePriorityTask
- Overrides:
getPriority
in classMobWanderTask
-