private IEnumerator DebugAfterDelay(IPendingPromise promise) { yield return(new WaitForSeconds(Delay)); UnityEngine.Debug.Log(DebugString); promise.Resolve(); }
private IEnumerator DoCleanup(IPendingPromise promise) { yield return(new WaitForSeconds(CleanAfterSeconds)); if (BPauseFlowForClean) { promise.Resolve(); } Destroy(_instance); }
private static IEnumerator Await(this AsyncOperation operation, IPendingPromise promise, string sceneName, bool debugMeOnLoad) { var timer = new Stopwatch(); timer.Start(); while (!operation.isDone) { yield return(operation); } if (debugMeOnLoad) { timer.Stop(); Debug.Log($"<color=green>⬤</color> Load <color=orange>{sceneName}</color> took: <color=white>{timer.Elapsed.Milliseconds}</color>ms"); } promise.Resolve(); }
/// <summary> /// Coroutine to do an async load. /// </summary> private IEnumerator LoadAsyncCoroutine(string sceneName, IPendingPromise result) { if (IsLoading) { DoneLoading(() => result.Reject(new SceneLoaderException( "Requested load of scene: " + sceneName + ", but already loading: " + LoadingSceneName ))); } RaiseSceneLoadingEvent(sceneName); StartLoading(sceneName, "async"); yield return(SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single)); NotifySceneLoaded(new [] { sceneName }); DoneLoading(result.Resolve); }
private static IEnumerator WaitUntilAsPromise(Func <bool> evaluator, IPendingPromise <Object> p) { yield return(new WaitUntil(evaluator)); p.Resolve(null); }
private IEnumerator WaitForSeconds(IPendingPromise promise) { yield return(new WaitForSeconds(Wait)); promise.Resolve(); }