Table of Contents

Class Task

Namespace
Lime
Assembly
Lime.dll

Sequence of actions, based on IEnumerators.

public class Task : IDisposable
Inheritance
Task
Implements
Inherited Members

Constructors

Task(IEnumerator<object>, object)

public Task(IEnumerator<object> e, object tag = null)

Parameters

e IEnumerator<object>
tag object

Properties

Completed

public bool Completed { get; }

Property Value

bool

Current

public static Task Current { get; }

Property Value

Task

Delta

Time delta since last Update.

public float Delta { get; }

Property Value

float

InitialEnumeratorType

public Type InitialEnumeratorType { get; }

Property Value

Type

Tag

public object Tag { get; set; }

Property Value

object

Methods

Advance(float)

Advances task to the next step of enumerator.

public void Advance(float delta)

Parameters

delta float

Delay(Func<bool>, Action)

Wait while predicate is true before executing an action.

public static IEnumerator<object> Delay(Func<bool> predicate, Action action)

Parameters

predicate Func<bool>
action Action

Returns

IEnumerator<object>

Delay(float, Action)

public static IEnumerator<object> Delay(float time, Action action)

Parameters

time float
action Action

Returns

IEnumerator<object>

Dispose()

Exits from all IEnumerators.

public void Dispose()

ExecuteAsync(Action, Action)

Invokes asyncAction asynchronously using Run(Action) and yields null until task is either completed, canceled or faulted. After that executes finishAction if it's not null.

public static IEnumerator<object> ExecuteAsync(Action asyncAction, Action finishAction = null)

Parameters

asyncAction Action

Action to execute asynchronously.

finishAction Action

Action to execute afterasyncAction is done.

Returns

IEnumerator<object>

An enumerator you can add to Tasks.

LinearMotion(float, float, float)

Returns a sequence of numbers, linear interpolated in specified time period. Advances by using Current.Delta.

public static IEnumerable<float> LinearMotion(float timePeriod, float from, float to)

Parameters

timePeriod float
from float
to float

Returns

IEnumerable<float>

Repeat(Func<bool>)

public static IEnumerator<object> Repeat(Func<bool> f)

Parameters

f Func<bool>

Returns

IEnumerator<object>

Sequence(params IEnumerator<object>[])

Creates a new Task executing all provided enumerators in sequential order

public static Task Sequence(params IEnumerator<object>[] args)

Parameters

args IEnumerator<object>[]

Returns

Task

SinMotion(float, float, float)

Returns a sequence of numbers, interpolated as sine in specified time period. Advances by using Current.Delta.

public static IEnumerable<float> SinMotion(float timePeriod, float from, float to)

Parameters

timePeriod float
from float
to float

Returns

IEnumerable<float>

SqrtMotion(float, float, float)

Returns a sequence of numbers, interpolated as square root in specified time period. Advances by using Current.Delta.

public static IEnumerable<float> SqrtMotion(float timePeriod, float from, float to)

Parameters

timePeriod float
from float
to float

Returns

IEnumerable<float>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

WaitForAnimation(Animation)

Proceeds while specified node is running animation.

public static WaitPredicate WaitForAnimation(Animation animation)

Parameters

animation Animation

Returns

WaitPredicate

WaitForInput()

Proceeds while there is no keystroke on the current window.

public static WaitPredicate WaitForInput()

Returns

WaitPredicate

WaitWhile(Func<bool>)

Proceeds while specified predicate returns true.

public static WaitPredicate WaitWhile(Func<bool> predicate)

Parameters

predicate Func<bool>

Returns

WaitPredicate

WaitWhile(Func<float, bool>)

Proceeds while specified predicate returns true. Argument of the predicate is time, that accumulates on Advance.

public static WaitPredicate WaitWhile(Func<float, bool> timePredicate)

Parameters

timePredicate Func<float, bool>

Returns

WaitPredicate