Exemple #1
0
        IEnumerator ShowIntro()
        {
            UN_CameraFade.FadeToBlack(null, 0.0f, null);
            for (int i = 0; i < _spashImages.Length; i++)
            {
                Dbg.Assert(_spashImages[i] != null);
                UN_CameraFade.ShowObject(_spashImages[i], true, null);
                UN_CameraFade.FadeToTransparent(null, i == 0 ? _fadeDuration : 5 * _fadeDuration);
                UN_CameraFade.Wait(_imageDuration);
                UN_CameraFade.FadeToBlack(null, _fadeDuration);
                UN_CameraFade.ShowObject(_spashImages[i], false, null);
            }
            UN_CameraFade.FadeToTransparent(null, _fadeDuration);
            while (UN_CameraFade.IsRunning)
            {
                yield return(null);
            }


            IEnumerator it = AlphaFadeIn(_theDuration, _finalText[0]);

            while (it.MoveNext())
            {
                yield return(null);
            }

            it = AlphaFadeIn(_theDuration, _finalText[1]);
            while (it.MoveNext())
            {
                yield return(null);
            }
            it = AlphaFadeIn(_theDuration, _finalText[2]);
            while (it.MoveNext())
            {
                yield return(null);
            }

            it = AlphaFadeIn(_pitDuration, _finalText[3]);
            while (it.MoveNext())
            {
                yield return(null);
            }

            for (int i = 0; i < _finalText.Length; i++)
            {
                _finalText[i].color = Color.red;
            }


            _introOp = null;
        }
Exemple #2
0
        IEnumerator SetActivePhase(GM_Phase newPhase)
        {
            Debug.Log("set active phase 1 : " + newPhase.GetType().ToString());


            UN_CameraFade.ClearAll();
            bool readyToSwitch1 = false;

            UN_CameraFade.FadeToBlack(() => { readyToSwitch1 = true; }, 2.0f);      //### PJS TO DO : remove time

            IEnumerator it;

            _previousPhase = _curPhase;
            if (_previousPhase != null)
            {
                it = _previousPhase.Exit(newPhase);
                while (it.MoveNext())
                {
                    yield return(null);
                }

                UN.SetActive(_previousPhase, false);
            }

            // wait for fade to black to be done
            while (readyToSwitch1 == false)
            {
                yield return(null);
            }

            _curPhase = newPhase;
            UN.SetActive(newPhase, true);
            it = newPhase.Enter(_previousPhase);
            while (it.MoveNext())
            {
                yield return(null);
            }

            string newSceneName = newPhase.SceneName;

            if (!string.IsNullOrEmpty(newSceneName) && newSceneName != SceneManager.GetActiveScene().name)
            {
                AsyncOperation loadingOp = SceneManager.LoadSceneAsync(newSceneName);
                if (loadingOp != null)
                {
                    while (loadingOp.isDone == false)
                    {
                        yield return(null);
                    }

                    Events.SendGlobal(new SceneChangedEvent()
                    {
                        Name = _curPhase.SceneName
                    });
                }
            }

            Events.SendGlobal(new GM_GamePhaseChangedEvent()
            {
                NewPhase = _curPhase == null ? null : _curPhase.GetType(),
                OldPhase = _previousPhase == null ? null : _previousPhase.GetType()
            });

            {
                bool readyToSwitch2 = false;
                UN_CameraFade.FadeToTransparent(() => { readyToSwitch2 = true; }, 2.0f);    //### pjs todo fix time
                while (readyToSwitch2 == false)
                {
                    yield return(null);
                }
            }
            _changingState = false;

            Debug.Log("set active phase 2 : " + newPhase.GetType().ToString());
        }