Ejemplo n.º 1
0
        public static IEnumerator LoadScene(string scene)
        {
            LoadingScreen.Show();
            var   operation = SceneManager.LoadSceneAsync(scene);
            float startTime = Time.time;

            operation.allowSceneActivation = false;
            //when the scene cant auto activate, progress is halted at 0.9, so check for that.
            yield return(new WaitUntil(() => operation.progress >= 0.9f && Time.time - startTime >= 1.4f));

            LoadingScreen.Hide();
            operation.allowSceneActivation = true;
        }
Ejemplo n.º 2
0
        //just a smooth way to get into the game.
        private IEnumerator LoadGame()
        {
            //TODO: fade out the menu music during the transition
            LoadingScreen.Show();
            menuBGM.DOFade(0, 1f).PlayForward();
            var   operation = SceneManager.LoadSceneAsync(gameScene);
            float startTime = Time.time;

            operation.allowSceneActivation = false;
            //when the scene cant auto activate, progress is halted at 0.9, so check for that.
            yield return(new WaitUntil(() => operation.progress >= 0.9f && Time.time - startTime >= 1.4f));

            LoadingScreen.Hide();
            operation.allowSceneActivation = true;
        }