public IEnumerator RunCoroutine(IRoutineRunner runner) { Result = new ObjectRoutineResult(); IsRunning = true; do { if (runner.Stopped) { break; } if (runner.Paused) { while (runner.Paused) { yield return(null); } } else { action.Invoke(); yield return(yieldInstruction); } } while (loopCondition.Invoke()); if (resultFunction != null) { Result = resultFunction.Invoke(); } else { Result = new EmptyRoutineResult(); } IsRunning = false; }
public IEnumerator RunCoroutine(IRoutineRunner runner) { IsRunning = true; for (int i = 0; i < performTimes; i++) { if (runner.Stopped) { break; } if (runner.Paused) { while (runner.Paused) { yield return(null); } } action.Invoke(); yield return(yieldInstruction); } if (resultFunction != null) { Result = resultFunction.Invoke(); } else { Result = new EmptyRoutineResult(); } IsRunning = false; }