Exemple #1
0
        IEnumerator LoadAssetLevelProgress(AssetBundles.AssetBundleLoadOperation in_loadingOperation)
        {
            if (!in_loadingOperation.IsDone())
            {
                yield return(YieldFactory.GetWaitForEndOfFrame());
            }

            // now its done, load the level
#if UNITY_EDITOR
            if (AssetBundles.AssetBundleManager.SimulateAssetBundleInEditor)
            {
                TransitionLoadComplete();
            }
            else
#endif
            {
                AssetBundles.AssetBundleLoadLevelOperation loadingOperation = (AssetBundles.AssetBundleLoadLevelOperation)in_loadingOperation;
                while (loadingOperation == null || loadingOperation._Request == null)
                {
                    yield return(null);
                }

                if (Application.HasProLicense())
                {
                    StartCoroutine(LoadLevelProgressProLicense(loadingOperation._Request));
                }
                else
                {
                    StartCoroutine(LoadLevelProgress(loadingOperation._Request));
                }
            }
        }
        private IEnumerator ResumeStateActions()
        {
            yield return(YieldFactory.GetWaitForEndOfFrame());

            if (OnStateChange != null)
            {
                OnStateChange(m_currentState);
            }

            BaseState currentState = CurrentState;

            // resume the state and become paused
            if (currentState != null && Time.timeScale == 0.0f && m_fSavedTimeDelta != 0.0f)
            {
                // restore the timescale, reset the saved time delta
                // and resume the current state
                Time.timeScale    = m_fSavedTimeDelta;
                m_fSavedTimeDelta = 0.0f;
                currentState.OnResumeState(true);
            }
            else if (currentState != null)
            {
                currentState.OnResumeState(false);
            }
        }
Exemple #3
0
        private IEnumerator SpinUntilManagersAreSetup()
        {
            while (!GCore.Instance.IsInitialized)
            {
                yield return(YieldFactory.GetWaitForEndOfFrame());
            }

            ContinueOnEnter();
        }
Exemple #4
0
        IEnumerator LoadLevelProgress(AsyncOperation in_loadingOperation)
        {
            float normTime = Mathf.Clamp01((Time.realtimeSinceStartup - m_fStartLoadingTime) / MIN_LOADING_TIME);

            while (normTime < 1.0f)                            // waiting for the time to transition
            {
                normTime = Mathf.Clamp01((Time.realtimeSinceStartup - m_fStartLoadingTime) / MIN_LOADING_TIME);
                yield return(YieldFactory.GetWaitForEndOfFrame());
            }

            TransitionLoadComplete();
        }
        private IEnumerator SafeOnAnimationEvent(object in_name)
        {
            yield return(YieldFactory.GetWaitForEndOfFrame());

            string name = (string)in_name;

            if (m_arEventListeners != null && m_arEventListeners.ContainsKey(name))
            {
                m_arEventListeners[name](this);
            }
            else
            {
                GDebug.LogWarning("Animation event key not found : " + name, gameObject);
            }
        }
Exemple #6
0
        private IEnumerator StartUpMgrs()
        {
            Physics.queriesHitTriggers = false;
            yield return(YieldFactory.GetWaitForEndOfFrame());

            GEventManager.Instance.EmptyStartup();
            yield return(YieldFactory.GetWaitForEndOfFrame());

            GPlayerHealth.Instance.EmptyStartup();
            yield return(YieldFactory.GetWaitForEndOfFrame());

            GAudioManager.Instance.EmptyStartup();
            yield return(YieldFactory.GetWaitForEndOfFrame());

            m_bInitialized = true;
        }
Exemple #7
0
        IEnumerator LoadLevelProgressProLicense(AsyncOperation in_loadingOperation)
        {
            float normTime = Mathf.Clamp01((Time.realtimeSinceStartup - m_fStartLoadingTime) / MIN_LOADING_TIME);

            while (!in_loadingOperation.isDone ||           // NOT , DONE
                   in_loadingOperation.progress < 0.9f ||   // progress less then 90%
                   normTime < 1.0f)                         // waiting for the time to transition
            {
                normTime = Mathf.Clamp01((Time.realtimeSinceStartup - m_fStartLoadingTime) / MIN_LOADING_TIME);

                // This is where I'm actually changing the scene
                if (in_loadingOperation.progress >= 0.9f)
                {
                    in_loadingOperation.allowSceneActivation = true;
                }

                yield return(YieldFactory.GetWaitForEndOfFrame());
            }

            TransitionLoadComplete();
        }
Exemple #8
0
        private IEnumerator StateChangeAfterTick(eState in_state)
        {
            yield return(YieldFactory.GetWaitForEndOfFrame());

            State = in_state;
        }