TaskQueue

class TaskQueue

The Task Queue is a scheduling system. It is a Queue to which Tasks can be added. A task is simply an object which contains a loop function which returns a boolean. The loop function of the task at the front of the queue will be executed every update cycle until it returns true. Once the task loop function returns true the task is discarded from the queue and the next task begins executing. By using ForkTasks and TaskLists it is possible to create arbitrarily complex trees of tasks. Loops of tasks can be implementing via recursion using a TaskList and CustomTask.

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
var task: Task
Link copied to clipboard

Functions

Link copied to clipboard
fun addTask(taskToAdd: Task)

Add a task to the queue

Link copied to clipboard
fun clear()

Remove all tasks from the queue

Link copied to clipboard

Check if there are currently tasks in the queue

Link copied to clipboard
fun pause()

Temporarily halt the execution of the queue

Link copied to clipboard
fun unpause()

Resume execution of the queue

Link copied to clipboard
fun update()

Execute the loop function of the current task and discard it if it is complete