Class MoveToPlantTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.MoveToPlantTask
- All Implemented Interfaces:
PriorityTask
,Task
The entity finds a living plant and moves towards it
-
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
ConstructorsConstructorDescriptionMoveToPlantTask
(int priority, com.badlogic.gdx.math.Vector2 speed, float stoppingDistance) -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the priority level of the move to plant task.void
start()
Starts the move to plant task by initialising the target plant and triggering the movement task.void
stop()
Stops the move to plant task and the associated movement task.void
update()
Updates the move to plant task by checking if the current target is dead.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
MoveToPlantTask
public MoveToPlantTask(int priority, com.badlogic.gdx.math.Vector2 speed, float stoppingDistance) - Parameters:
priority
- Task priority when moving (-1 when not moving)speed
- The speed at which to move to plant.
-
-
Method Details
-
start
public void start()Starts the move to plant task by initialising the target plant and triggering the movement task.- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Updates the move to plant task by checking if the current target is dead. If the current target is not dead, it will continue to move to it until it has arrived. If the current target is dead, it will switch to a new target if one exists.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
stop
public void stop()Stops the move to plant task and the associated movement task.- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()Gets the priority level of the move to plant task.- Specified by:
getPriority
in interfacePriorityTask
- Returns:
- The priority level.
-