private IEnumerator FadeOutRoutine()
        {
            yield return(AlphaChangeRoutine(1, _duration));

            faded = true;
            FadeOutComplete?.Invoke();
        }
    private static void StartFadeOut()
    {
        FadeOutComplete = null;
        BlackFadeController goController = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("Prefabs/Black Fade")).GetComponent <BlackFadeController>();

        goController.FadeOut();
        goController.FadeCompleted += () => FadeOutComplete?.Invoke();
        goController.FadeCompleted += () => UnityEngine.Object.Destroy(goController.gameObject);
    }
        public void Update()
        {
            if (IsActive)
            {
                if (fadingOut)
                {
                    if (time < timeFadeOut)
                    {
                        time++;
                    }

                    if (time == timeFadeOut)
                    {
                        fadingOut = false;
                        hold      = true;
                        time      = timeBlack;
                        FadeOutComplete?.Invoke();
                    }
                }
                else if (hold)
                {
                    if (time > 0)
                    {
                        time--;
                    }

                    if (time == 0)
                    {
                        time = timeFadeIn;
                        hold = false;
                    }
                }
                else
                {
                    if (time > 0)
                    {
                        time--;
                    }

                    if (time == 0)
                    {
                        IsActive = false;
                    }
                }
            }
        }
示例#4
0
        private void OnFadeOutComplete(FadeOutComplete obj)
        {
            AbstractGlobalController.Instance.FadeV.StartFadeIn();
            MessageAgregator <FadeInComplete> .AddListener(OnFadeInComplete);

            //EventAgregator.AddListener(EventKey.fadeInComplete, );

            SceneManager.SetActiveScene(
                SceneManager.GetSceneByName(AbstractGameController.Instance.MyKeys.CenaAtiva.ToString()));

            SaveDatesManager.SalvarAtualizandoDados();

            fase = FasesDoLoad.eventInProgress;

            SceneManager.UnloadSceneAsync(NomesCenasEspeciais.CenaDeCarregamento.ToString());

            //GameController.g.ModificacoesDaCena();
            Time.timeScale    = 1;
            Physics2D.gravity = new Vector2(0, -0.8f);
        }
示例#5
0
    public void FadeOut(System.Action EndAction = null)
    {
        GetUnknownDefaultColors();

        if (anim.IsRunning())
        {
            StopCoroutine(anim);
        }

        anim = this.ProgressionAnim(fadeDuration, (progression) =>
        {
            for (int i = 0; i < graphicsToAnimate.Count; i++)
            {
                graphicsToAnimate[i].color = Color.Lerp(graphicsToAnimate[i].color, fadeColor, progression);
            }
        }, () =>
        {
            anim = null;
            EndAction?.Invoke();
            FadeOutComplete.Invoke();
        });
    }
示例#6
0
        private IEnumerator FadeOutPage()
        {
            yield return(StartCoroutine(Coroutines.FadeTo(_canvasGroup, 0, 1)));

            FadeOutComplete?.Invoke();
        }