Class MoveToShipTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.MoveToShipTask
- All Implemented Interfaces:
PriorityTask,Task
The entity finds a ship and moves towards it.
Adapted from Team 4's MoveToPlantTask.
-
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
ConstructorsConstructorDescriptionMoveToShipTask(int priority, com.badlogic.gdx.math.Vector2 speed, float stoppingDistance) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(TaskRunner taskRunner) Create the task and attach it to the task runner.intGets the priority level of the move to ship task.voidstart()Starts the move to ship task by initialising the target ship and triggering the movement task.voidstop()Stops the move to ship task and the associated movement task.voidupdate()Stop moving to the ship if already there.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
getStatus
-
Constructor Details
-
MoveToShipTask
public MoveToShipTask(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 ship.
-
-
Method Details
-
create
Description copied from interface:TaskCreate the task and attach it to the task runner.- Specified by:
createin interfaceTask- Overrides:
createin classDefaultTask- Parameters:
taskRunner- Task runner to attach to
-
start
public void start()Starts the move to ship task by initialising the target ship and triggering the movement task.- Specified by:
startin interfaceTask- Overrides:
startin classDefaultTask
-
update
public void update()Stop moving to the ship if already there.- Specified by:
updatein interfaceTask- Overrides:
updatein classDefaultTask
-
stop
public void stop()Stops the move to ship task and the associated movement task.- Specified by:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
getPriority
public int getPriority()Gets the priority level of the move to ship task.- Specified by:
getPriorityin interfacePriorityTask- Returns:
- The priority level.
-