KernelAPI reference
Class CoroutineRunner
Namespace: MicroEngine.Scenes
Assembly: MicroEngine.dll
Guide: Scenes
Runs iterator-based sequences one step per update. A coroutine may yield null (next update), Seconds, Until or another IEnumerator (awaited as a sub-routine). Ideal for cutscenes, dialogue flow and timed effects without hand-written state machines.
public sealed class CoroutineRunner : IStateHashedInheritance
Implements
Constructors
CoroutineRunner()
public CoroutineRunner()Properties
Count
Number of coroutines that are running or waiting to start.
public int Count { get; }Property Value
Methods
HashState(StateHasher)
Adds the runner’s state to the per-step state hash: for each coroutine, running or waiting to start, its nesting depth, the seconds left to wait and whether it waits for a condition. The iterators’ own variables are not visible to it; a scene adds the state its coroutines change from its own HashState.
public void HashState(StateHasher hash)Parameters
hash StateHasher
Start(IEnumerator)
Starts a coroutine. Its first step runs on the next Update, not immediately.
public CoroutineHandle Start(IEnumerator routine)Parameters
routine IEnumerator
The iterator, usually from a method that uses yield return.
Returns
A handle to cancel the coroutine or check whether it finished.
Exceptions
routine is null.
StopAll()
Stops every coroutine, including those started but not yet run.
public void StopAll()Update(float)
Advances every coroutine by one step. A scene calls this for its own Coroutines; call it yourself only for a runner you created.
public void Update(float dt)Parameters
dt float
Elapsed time in seconds, consumed by Seconds.
Exceptions
A coroutine yielded a value other than null, a wait instruction or an IEnumerator.