Class SpawnTask

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

public class SpawnTask extends DefaultTask implements PriorityTask
A task that spawns an entity at a specified position after a certain duration.
  • Constructor Details

    • SpawnTask

      public SpawnTask(com.badlogic.gdx.math.Vector2 spawnPosition, float spawnDuration)
      Constructs a new SpawnTask with the specified spawn position and duration.
      Parameters:
      spawnPosition - the position where the entity will be spawned
      spawnDuration - the duration of the spawn task
  • Method Details

    • getSpawnPosition

      public com.badlogic.gdx.math.Vector2 getSpawnPosition()
      Returns the position where the entity will be spawned.
      Returns:
      the spawn position
    • getSpawnDuration

      public float getSpawnDuration()
      Returns the duration of the spawn task.
      Returns:
      the spawn duration
    • getElapsedTime

      public float getElapsedTime()
      Returns the elapsed time since the spawn task started.
      Returns:
      the elapsed time
    • getPriority

      public int getPriority()
      Returns the priority of this task. Higher values indicate higher priority.
      Specified by:
      getPriority in interface PriorityTask
      Returns:
      the priority of this task
    • start

      public void start()
      Starts the spawn task, positioning the entity at the spawn location.
      Specified by:
      start in interface Task
      Overrides:
      start in class DefaultTask
    • completeTask

      public void completeTask()
      Completes the spawn task, stopping it and cleaning up if necessary.