void Start() { c = new CoroutinePromise(CoroutineA()); ca = c.Then(CoroutineB()); CoroutinePromise cb = ca.Then(CoroutineC()); StartPromiseSet(c); CoroutinePromise c2 = new CoroutinePromise(CoroutineA2()); c2.Then(CoroutineB2()).Then(CoroutineC2()); StartPromiseSet(c2); }
public IEnumerator SuperCoroutine() { while (currentPromise != null) { if (!(!currentPromise.IsDone && currentPromise.Coroutine.MoveNext())) { if (currentPromise.Promise != null) { currentPromise = currentPromise.Promise; } else { currentPromise = null; } } yield return(null); } }
public CoroutinePromiseSet(CoroutinePromise c) { currentPromise = c; }
public CoroutinePromise Resolve(IEnumerator newCoroutine) { promise = new CoroutinePromise(newCoroutine); isDone = true; return(promise); }
public CoroutinePromise Then(IEnumerator newCoroutine) { promise = new CoroutinePromise(newCoroutine); return(promise); }
public void StartPromiseSet(CoroutinePromise c) { CoroutinePromiseSet cSet = new CoroutinePromiseSet(c); StartCoroutine(cSet.SuperCoroutine()); }
public IEnumerator SuperCoroutine() { while (currentPromise != null) { if (!(!currentPromise.IsDone && currentPromise.Coroutine.MoveNext())) { if (currentPromise.Promise != null) currentPromise = currentPromise.Promise; else currentPromise = null; } yield return null; } }
public CoroutinePromise Then(IEnumerator newCoroutine) { promise = new CoroutinePromise(newCoroutine); return promise; }
public CoroutinePromise Resolve(IEnumerator newCoroutine) { promise = new CoroutinePromise(newCoroutine); isDone = true; return promise; }