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
Current
public static Task Current { get; }
Property Value
Delta
Time delta since last Update.
public float Delta { get; }
Property Value
InitialEnumeratorType
public Type InitialEnumeratorType { get; }
Property Value
Tag
public object Tag { get; set; }
Property Value
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
Returns
Delay(float, Action)
public static IEnumerator<object> Delay(float time, Action action)
Parameters
Returns
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
ActionAction to execute asynchronously.
finishAction
ActionAction to execute after
asyncAction
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
Returns
Repeat(Func<bool>)
public static IEnumerator<object> Repeat(Func<bool> f)
Parameters
Returns
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
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
Returns
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
Returns
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
WaitForInput()
Proceeds while there is no keystroke on the current window.
public static WaitPredicate WaitForInput()
Returns
WaitWhile(Func<bool>)
Proceeds while specified predicate returns true.
public static WaitPredicate WaitWhile(Func<bool> predicate)
Parameters
Returns
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)