Example #1
0
    void ComunsCarregado()
    {
        if (ExistenciaDoController.AgendaExiste(ComunsCarregado, this))
        {
            fase = FasesDoLoad.carregando;
            S    = new LoadAndSaveGame().Load(indiceDoJogo);
            if (S == null)
            {
                a2    = new AsyncOperation[1];
                a2[0] = SceneManager.LoadSceneAsync("MbInfinity", LoadSceneMode.Additive);
            }
            else
            {
                a2 = new AsyncOperation[S.VariaveisChave.CenasAtivas.Count];
                for (int i = 0; i < a2.Length; i++)
                {
                    a2[i] = SceneManager.LoadSceneAsync(S.VariaveisChave.CenasAtivas[i].ToString(), LoadSceneMode.Additive);
                }
            }
            Time.timeScale = 0;

            SceneManager.sceneLoaded -= CarregouComuns;
            SceneManager.sceneLoaded += SetarCenaPrincipal;
        }
    }
Example #2
0
    public void Update()
    {
        switch (fase)
        {
        case FasesDoLoad.carregando:

            tempo += Time.fixedDeltaTime;

            float progresso = 0;

            for (int i = 0; i < a2.Length; i++)
            {
                progresso += a2[i].progress;
            }

            progresso /= a2.Length;

            //Debug.Log(progresso + " : " + (tempo / tempoMin) + " : " + Mathf.Min(progresso, tempo / tempoMin, 1));

            loadBar.ValorParaBarra(Mathf.Min(progresso, tempo / tempoMin, 1));

            if (podeIr && tempo >= tempoMin)
            {
                SceneManager.MoveGameObjectToScene(GameObject.Find("EventSystem"), SceneManager.GetSceneByName("comunsDeFase"));
                pretoMorte pm = GameController.g.gameObject.AddComponent <pretoMorte>();
                pm.vel = 2;
                fase   = FasesDoLoad.escurecendo;
                tempo  = 0;
            }

            break;

        case FasesDoLoad.escurecendo:
            tempo += Time.fixedDeltaTime;
            if (tempo > 0.95f)
            {
                GameObject.FindObjectOfType <pretoMorte>().entrando = false;
                FindObjectOfType <Canvas>().enabled = false;
                fase = FasesDoLoad.clareando;
                SceneManager.SetActiveScene(
                    SceneManager.GetSceneByName(GameController.g.MyKeys.CenaAtiva.ToString()));
                GameController.g.Salvador.SalvarAgora();
                Time.timeScale = 1;
                tempo          = 0;
            }
            break;

        case FasesDoLoad.clareando:
            tempo += Time.fixedDeltaTime;
            if (tempo > 0.5f)
            {
                SceneManager.UnloadSceneAsync("CenaDeCarregamento");
                Destroy(gameObject);
            }
            break;
        }
    }
Example #3
0
    void ComunsCarregado()
    {
        fase = FasesDoLoad.carregando;


        a2 = new AsyncOperation[cenasParaCarregar.Length];
        for (int i = 0; i < a2.Length; i++)
        {
            a2[i] = SceneManager.LoadSceneAsync(cenasParaCarregar[i].ToString(), LoadSceneMode.Additive);
        }
        Time.timeScale = 0;

        SceneManager.sceneLoaded -= CarregouComuns;
        SceneManager.sceneLoaded += SetarCenaPrincipal;
    }
Example #4
0
    private void OnFadeOutComplete(IGameEvent obj)
    {
        GlobalController.g.FadeV.IniciarFadeIn();
        EventAgregator.AddListener(EventKey.fadeInComplete, OnFadeInComplete);

        SceneManager.SetActiveScene(
            SceneManager.GetSceneByName(GameController.g.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);
    }
Example #5
0
        void ComunsCarregado()
        {
            if (StaticInstanceExistence <IGameController> .SchelduleExistence(ComunsCarregado, this, () => {
                return(AbstractGameController.Instance);
            }))
            //if (ExistenciaDoController.AgendaExiste(ComunsCarregado, this))
            {
                SceneManager.sceneLoaded -= CarregouComuns;
                SceneManager.sceneLoaded += SetarCenaPrincipal;
                SceneManager.sceneLoaded += TatudoCarregado;

                if (SaveDatesManager.s.SavedGames.Count > indiceDoJogo)
                {
                    S = SaveDatesManager.s.SavedGames[indiceDoJogo];
                }
                else
                {
                    S = null;
                }

                if (S == null)
                {
                    fase          = FasesDoLoad.carregando;
                    aSerCarregado = 1;
                    a2            = new AsyncOperation[1];
                    a2[0]         = AditiveLoadScene(NomesCenas.TutoScene);
                }
                else
                {
                    NomesCenas[] N2 = DescarregarCenasDesnecessarias(S.VariaveisChave.CenasAtivas.ToArray());

                    numCarregador = 0;
                    aSerCarregado = N2.Length;


                    for (int i = 0; i < N2.Length; i++)
                    {
                        SceneManager.UnloadSceneAsync(N2[i].ToString());
                    }

                    FuncaoCarregadora();
                }
            }
        }
Example #6
0
        public void Update()
        {
            switch (fase)
            {
            case FasesDoLoad.carregando:

                tempo += Time.fixedDeltaTime;

                float progresso = 0;
                if (a2.Length > 0)
                {
                    for (int i = 0; i < a2.Length; i++)
                    {
                        progresso += a2[i].progress;
                    }

                    progresso /= a2.Length;
                }
                else
                {
                    progresso = 1;
                }

                loadBar.ValorParaBarra(Mathf.Min(progresso, tempo / tempoMin, 1));

                if (podeIr && tempo >= tempoMin)
                {
                    GameObject go = GameObject.Find("EventSystem");
                    if (go)
                    {
                        SceneManager.MoveGameObjectToScene(go, SceneManager.GetSceneByName(NomesCenasEspeciais.ComunsDeFase.ToString()));
                    }

                    AbstractGlobalController.Instance.FadeV.StartFadeOut();
                    MessageAgregator <FadeOutComplete> .AddListener(OnFadeOutComplete);

                    //EventAgregator.AddListener(EventKey.fadeOutComplete, OnFadeOutComplete);
                    fase = FasesDoLoad.eventInProgress;
                }

                break;
            }
        }
Example #7
0
    void FuncaoCarregadora()
    {
        fase = FasesDoLoad.carregando;
        NomesCenas[] N = PegueAsCenasPorCarregar(S.VariaveisChave.CenasAtivas.ToArray());


        aSerCarregado = N.Length;

        a2 = new AsyncOperation[N.Length];
        for (int i = 0; i < N.Length; i++)
        {
            a2[i] = SceneManager.LoadSceneAsync(N[i].ToString(), LoadSceneMode.Additive);
        }



        if (N.Length == 0 || SceneManager.GetSceneByName(GameController.g.MyKeys.CenaAtiva.ToString()).isLoaded)
        {
            SetarCenaPrincipal(SceneManager.GetSceneByName(GameController.g.MyKeys.CenaAtiva.ToString()), LoadSceneMode.Single);
            TatudoCarregado();
        }
        Time.timeScale = 0;
    }
Example #8
0
        void ComunsCarregado()
        {
            if (ExistenciaDoController.AgendaExiste(ComunsCarregado, this))
            {
                fase = FasesDoLoad.carregando;

                //S = new LoadAndSaveGame().Load(indiceDoJogo);

                if (SaveDatesForJolt.s.SavedGames.Count > indiceDoJogo)
                {
                    S = SaveDatesForJolt.s.SavedGames[indiceDoJogo];
                }
                else
                {
                    S = null;
                }

                if (S == null)
                {
                    a2    = new AsyncOperation[2];
                    a2[0] = SceneManager.LoadSceneAsync("cavernaIntro", LoadSceneMode.Additive);
                    a2[1] = SceneManager.LoadSceneAsync(NomesCenas.katidsVsTempleZone.ToString(), LoadSceneMode.Additive);
                }
                else
                {
                    a2 = new AsyncOperation[S.VariaveisChave.CenasAtivas.Count];
                    for (int i = 0; i < a2.Length; i++)
                    {
                        a2[i] = SceneManager.LoadSceneAsync(S.VariaveisChave.CenasAtivas[i].ToString(), LoadSceneMode.Additive);
                    }
                }
                Time.timeScale = 0;

                SceneManager.sceneLoaded -= CarregouComuns;
                SceneManager.sceneLoaded += SetarCenaPrincipal;
            }
        }
Example #9
0
    public void Update()
    {
        switch (fase)
        {
        case FasesDoLoad.carregando:

            tempo += Time.fixedDeltaTime;

            float progresso = 0;

            for (int i = 0; i < a2.Length; i++)
            {
                progresso += a2[i].progress;
            }

            progresso /= a2.Length;

            //Debug.Log(progresso + " : " + (tempo / tempoMin) + " : " + Mathf.Min(progresso, tempo / tempoMin, 1));

            loadBar.ValorParaBarra(Mathf.Min(progresso, tempo / tempoMin, 1));

            if (podeIr && tempo >= tempoMin)
            {
                GameObject go = GameObject.Find("EventSystem");
                if (go)
                {
                    SceneManager.MoveGameObjectToScene(go, SceneManager.GetSceneByName("comunsDeFase"));
                }

                //FadeView pm = GameController.g.gameObject.AddComponent<FadeView>();
                FadeView pm = ControladorGlobal.c.gameObject.AddComponent <FadeView>();
                pm.vel = 2;
                fase   = FasesDoLoad.escurecendo;
                tempo  = 0;
            }

            break;

        case FasesDoLoad.escurecendo:
            tempo += Time.fixedDeltaTime;
            if (tempo > 0.95f)
            {
                GameObject.FindObjectOfType <FadeView>().entrando = false;
                FindObjectOfType <Canvas>().enabled = false;
                fase = FasesDoLoad.clareando;
                SceneManager.SetActiveScene(
                    SceneManager.GetSceneByName(cenasParaCarregar[0].ToString()));
                //InformacoesDeCarregamento.FacaModificacoes();
                //GameController.g.Salvador.SalvarAgora();
                Time.timeScale = 1;
                SceneManager.UnloadSceneAsync(NomesCenas.CenaDeCarregamento.ToString());
                tempo = 0;
            }
            break;

        case FasesDoLoad.clareando:
            tempo += Time.fixedDeltaTime;
            if (tempo > 0.5f)
            {
                Destroy(gameObject);
            }
            break;
        }
    }