private IEnumerator ExecuteCoroutineAction(CoroutineAction action, bool outOfFlow = false) { IEnumerator enumerator = action.action(); while (true) { object current; try { if (enumerator.MoveNext() == false) { action.OnSuccessCallback?.Invoke(); break; } current = enumerator.Current; } catch (Exception e) { action.OnFailureCallback?.Invoke(e); if (action.WillStopOnError) { StopAll(); } yield break; } yield return(current); } }
public static GameAction TestCoroutine(int duration) => CoroutineAction .Create("Test Coroutine", () => TestCoroutineMethod(duration));
public static GameAction TestCoroutineWithError(int duration, Exception error) => CoroutineAction .Create("Test Coroutine With Error", () => TestCoroutineMethod(duration, error));
public static GameAction Wait(float duration) => CoroutineAction.Create(string.Format("Waiting for {0}sec", duration), () => RunWait(duration));