Class EnemyMovement

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

public class EnemyMovement extends DefaultTask implements PriorityTask
AI task to handle enemy movement
  • Constructor Details

    • EnemyMovement

      public EnemyMovement(AtlantisTerrainFactory terrainFactory)
      Creates an EnemyMovement instance.
      Parameters:
      terrainFactory - The terrain factory representing the game area.
  • Method Details

    • start

      public void start()
      Start running this task. This will usually be called by an AI controller.
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • update

      public void update()
      Run one frame of the task. Similar to the update() in Components.
      Specified by:
      update in interface Task
      Overrides:
      update in class DefaultTask
    • getPriority

      public int getPriority()
      Returns priority of task
      Specified by:
      getPriority in interface PriorityTask
      Returns:
    • stop

      public void stop()
      Stop the task immediately. This can be called at any time by the AI controller.
      Specified by:
      stop in interface Task
      Overrides:
      stop in class DefaultTask
    • getDestinationPoint

      public com.badlogic.gdx.math.Vector2 getDestinationPoint()
      Returns the destination point of entity
      Returns:
      destination point of entity
    • setDestinationPoint

      public void setDestinationPoint(com.badlogic.gdx.math.Vector2 destinationPoint)
      Sets the destination point of entity
      Parameters:
      destinationPoint - Destination point of entity
    • getStartPos

      public com.badlogic.gdx.math.Vector2 getStartPos()
      Returns the starting position upon spawning of entity
      Returns:
      spawn point of entity
    • setStartPos

      public void setStartPos(com.badlogic.gdx.math.Vector2 startPos)
      Sets the starting position of entity
      Parameters:
      startPos - spawn point of entity
    • selectRandomTarget

      public void selectRandomTarget()
    • createMovementTask

      public void createMovementTask()
      Creates a movement task.
    • setMovementTask

      public void setMovementTask(MovementTask movementTask)
      Sets the movement task
      Parameters:
      movementTask - movement task to be set
    • setCurrentTask

      public void setCurrentTask(Task currentTask)
      Sets the current task
      Parameters:
      currentTask - cureent task to be set