Skip to content

PlumpMath/New-Coroutine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NewCoroutine

Please free to use.

Sample in /Assets/Scripts/Coroutine/Sample

How to use

IEnumator Foo() {
    yield return null;
}

Simple coroutine

CoroutineExecutor.Do(Foo());

Group coroutine

var group = new GroupCoroutine(Foo());
group.Add(Foo());
CoroutineExecutor.Do(group);

Order courtine

var order = new OrderCoroutine(Foo1());
order.Add(Foo2());
CoroutineExecutor.Do(order);

Event coroutine

// It will wait until receiving event
var ev = new EventCoroutine(new string[] {"ABC", "123"});
yield return ev;

// After some coroutine wait for event,  You can send event by this way to trigger EventCoroutine to finish. 
CoroutineExeCcutor.SendEvent("ABC");

// Then every EventCoroutine wait for "ABC" event will be finished.

Executing during FixedUpdate()

yield return BaseCoroutine.WaitFor.FixedUpdate;
or yield return new WaitForFixedUpdate();

Excuting during EndOfFrame()

yield return BaseCoroutine.WaitFor.EndOfFrame;
or yield return new WaitForEndOfFrame();

Pause Coroutine

var co = CoroutineExecutor.Do(Foo());

// Pause
co.Pause = true;
// Resume
co.Pause = false;

Cancel Coroutine

var co = CoroutineExecutor.Do(Foo());

co.Cancel();

Others

Support Playmaker

Packages

No packages published

Languages

  • C# 100.0%