Coroutine chain management, easry to read and able to chain coroutines to run on the fly or run later.
Create and Run a chain on the fly.
void foo()
{
//A, B, C are IEnumerators
CoroutineChainer.Start()
.ChainWith(Coroutine())
.Sequential(A(),B(),C()) // play one by one.
.Parallel(A(),B(),C()) // play same time.
.Log("Complete!");
.Call(()=>Callback())
.RunCoroutine();
}
Create a chain and run it later
ChainBase coroutine;
void foo()
{
coroutine = CoroutineChainer.Start()
.ChainWith(A())
.ChainWith(B());
}
void foo2()
{
if(someCondition)
coroutine?.RunCoroutine();
}