Class MoveToPlantTask

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

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

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

    Modifier and Type
    Method
    Description
    int
    Gets the priority level of the move to plant task.
    void
    Starts the move to plant task by initialising the target plant and triggering the movement task.
    void
    Stops the move to plant task and the associated movement task.
    void
    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

    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

    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 interface Task
      Overrides:
      start in class DefaultTask
    • 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 interface Task
      Overrides:
      update in class DefaultTask
    • stop

      public void stop()
      Stops the move to plant 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 plant task.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      The priority level.