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 TypeMethodDescriptionvoid
create
(TaskRunner taskRunner) Create the task and attach it to the task runner.int
Gets the priority level of the move to ship task.void
start()
Starts the move to ship task by initialising the target ship and triggering the movement task.void
stop()
Stops the move to ship task and the associated movement task.void
update()
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:Task
Create the task and attach it to the task runner.- Specified by:
create
in interfaceTask
- Overrides:
create
in 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:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Stop moving to the ship if already there.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
stop
public void stop()Stops the move to ship 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 ship task.- Specified by:
getPriority
in interfacePriorityTask
- Returns:
- The priority level.
-