The Task Manager is used to perform tasks (call methods) in specified order. Allows you to quickly and easily program any action, such as the appearance of the buttons in the game menus. Task Manager is started automatically when you add at least one task, and stops when all tasks are done.

Available since

11.19.2012

.

Constructor

@:value({ Cycle : false })new(Cycle:Bool = false, ?OnComplete:() ‑> Void)

Variables

@:value(0)read onlylength:Int = 0

Number of tasks in the list

onComplete:() ‑> Void

This function will be called when all tasks in the task manager are completed

Methods

@:value({ IgnoreCycle : false })addInstantTask(Function:() ‑> Bool, IgnoreCycle:Bool = false):Void

Adds a task to the end of queue, the method will be executed only ONCE, after that we go to the next task.

Parameters:

Function

Method-task to be executed in sequence.

IgnoreCycle

If true then the task will be deleted from the manager immediately after execution.

@:value({ IgnoreCycle : false })addPause(Delay:Float, IgnoreCycle:Bool = false):Void

Adds a pause between tasks

Parameters:

Delay

Pause duration

IgnoreCycle

If true, the pause will be executed only once per cycle

@:value({ IgnoreCycle : false })addTask(Function:() ‑> Bool, IgnoreCycle:Bool = false):Void

Adds a task to the end of queue, the method will be executed while it returns false. The task will be completed only when the method will return true. And manager will switch to the next task.

Parameters:

Function

Method-task to be executed in sequence.

IgnoreCycle

If true then the task will be deleted from the manager immediately after execution.

@:value({ IgnoreCycle : false })addUrgentInstantTask(Function:() ‑> Bool, IgnoreCycle:Bool = false):Void

Adds a task to the top of the queue, the method will be executed only ONCE, after that we go to the next task.

Parameters:

Function

Method-task to be executed in sequence.

IgnoreCycle

If true then the task will be deleted from the manager immediately after execution.

@:value({ IgnoreCycle : false })addUrgentTask(Function:() ‑> Bool, IgnoreCycle:Bool = false):Void

Adds a task to the top of the queue, the method will be executed while it returns false. The task will be completed only when the method will return true, and the manager will move to the next task.

Parameters:

Function

Method-task to be executed in sequence.

IgnoreCycle

If true then the task will be deleted from the manager immediately after execution.

clear():Void

Removes all the tasks from manager and stops it

@:value({ IgnoreCycle : false })nextTask(IgnoreCycle:Bool = false):Void

Move to the next task

Parameters:

IgnoreCycle

Specifies whether to leave the previous problem in the manager

update(elapsed:Float):Void

Current task processing

Inherited Variables

Defined by FlxBasic

@:value(idEnumerator++)ID:Int = idEnumerator++

A unique ID starting from 0 and increasing by 1 for each subsequent FlxBasic that is created.

@:value(true)active:Bool = true

Controls whether update() is automatically called by FlxState/FlxGroup.

@:value(true)alive:Bool = true

Useful state for many game objects - "dead" (!alive) vs alive. kill() and revive() both flip this switch (along with exists, but you can override that).

camera:FlxCamera

Gets or sets the first camera of this object.

cameras:Array<FlxCamera>

This determines on which FlxCameras this object will be drawn. If it is null / has not been set, it uses the list of default draw targets, which is controlled via FlxG.camera.setDefaultDrawTarget as well as the DefaultDrawTarget argument of FlxG.camera.add.

@:value(true)exists:Bool = true

Controls whether update() and draw() are automatically called by FlxState/FlxGroup.

@:value(true)visible:Bool = true

Controls whether draw() is automatically called by FlxState/FlxGroup.

Inherited Methods

Defined by FlxBasic

draw():Void

Override this function to control how the object is drawn. Doing so is rarely necessary, but can be very useful.

kill():Void

Handy function for "killing" game objects. Use reset() to revive them. Default behavior is to flag them as nonexistent AND dead. However, if you want the "corpse" to remain in the game, like to animate an effect or whatever, you should override this, setting only alive to false, and leaving exists true.

revive():Void

Handy function for bringing game objects "back to life". Just sets alive and exists back to true. In practice, this function is most often called by FlxObject#reset().