Class MoveToShipTask

java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.MoveToShipTask
All Implemented Interfaces:
PriorityTask, Task

public class MoveToShipTask extends DefaultTask implements PriorityTask
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

    Constructors
    Constructor
    Description
    MoveToShipTask(int priority, com.badlogic.gdx.math.Vector2 speed, float stoppingDistance)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Starts the move to ship task by initialising the target ship and triggering the movement task.
    void
    Stops the move to ship task and the associated movement task.
    void
    Stop moving to the ship if already there.

    Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask

    getStatus

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.csse3200.game.ai.tasks.Task

    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

      public void create(TaskRunner taskRunner)
      Description copied from interface: Task
      Create the task and attach it to the task runner.
      Specified by:
      create in interface Task
      Overrides:
      create in class DefaultTask
      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 interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      Stop moving to the ship if already there.
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • stop

      public void stop()
      Stops the move to ship task and the associated movement task.
      Specified by:
      stop in interface Task
      Overrides:
      stop in class DefaultTask
    • getPriority

      public int getPriority()
      Gets the priority level of the move to ship task.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      The priority level.