Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        private static IEnumerator WaitUntilAsPromise(Func <bool> evaluator, IPendingPromise <Object> p)
        {
            yield return(new WaitUntil(evaluator));

            p.Resolve(null);
        }
Ejemplo n.º 6
0
        private IEnumerator WaitForSeconds(IPendingPromise promise)
        {
            yield return(new WaitForSeconds(Wait));

            promise.Resolve();
        }