Exemplo n.º 1
0
 private IEnumerator OnPlayPressedRoutine()
 {
     TransitionFader.PlayTransition(startTransitionPrefab);
     LevelLoader.LoadNextLevel();
     GameMenu.Open();
     yield return(new WaitForSeconds(_playDelay));
 }
Exemplo n.º 2
0
        private IEnumerator OnPlayPressedRoutine()
        {
            TransitionFader.PlayTransition(startTransitionPrefab);
            LevelLoader.LoadNextLevel();
            yield return(new WaitForSeconds(_playDelay)); // i dont like this solution. It adds .5 seconds delay on key press.

            GameMenu.Open();
        }
Exemplo n.º 3
0
        private IEnumerator PlayMissionRoutine(string sceneName)
        {
            TransitionFader.PlayTransition(_playTrasitionPrefab);
            LevelLoader.LoadLevel(sceneName);
            yield return(new WaitForSeconds(_playDelay));

            GameMenu.Open();
        }
Exemplo n.º 4
0
        IEnumerator OnCollectModePressedRoutine()
        {
            TransitionFader.PlayTransition(startTransitionPrefab);
            LevelLoader.LoadCollectModeLevel();
            yield return(new WaitForSeconds(_playDelay));

            GameMenu.Open();
        }
Exemplo n.º 5
0
 // instantiate a transition prefab and fade on/off
 public static void PlayTransition(TransitionFader transitionPrefab)
 {
     if (transitionPrefab != null)
     {
         TransitionFader instance = Instantiate(transitionPrefab, Vector3.zero, Quaternion.identity);
         instance.Play();
     }
 }
Exemplo n.º 6
0
        // restart tutorial coroutine
        private IEnumerator OnRestartTutorialPressedRoutine()
        {
            TransitionFader.PlayTransition(levelTransitionPrefab, 1);
            yield return(new WaitForSeconds(_playDelay));

            LevelLoader.LoadLevel("2_Level-1");
            base.OnBackPressed();
            _active = false;
        }
Exemplo n.º 7
0
        // restart level coroutine
        private IEnumerator OnRestartLevelPressedRoutine()
        {
            TransitionFader.PlayTransition(levelTransitionPrefab, LevelLoader.CurrentSceneIndex - 1);
            yield return(new WaitForSeconds(_playDelay));

            base.OnBackPressed();
            LevelLoader.ReloadLevel();
            _active = false;
        }
Exemplo n.º 8
0
        // start the transition and play the first level
        private IEnumerator OnPlayPressedRoutine()
        {
            TransitionFader.PlayTransition(startTransitionPrefab, LevelLoader.CurrentSceneIndex);
            yield return(new WaitForSeconds(_playDelay));

            LevelLoader.LoadNextLevel();
            GameMenu.Open();
            _active = false;
        }
Exemplo n.º 9
0
        private IEnumerator OnNextPressedRoutine()
        {
            TransitionFader.PlayTransition(_transitionPrefab, LevelLoader.CurrentSceneIndex);
            yield return(new WaitForSeconds(_playDelay));

            LevelLoader.LoadNextLevel();
            base.OnBackPressed();
            _active = false;
        }
Exemplo n.º 10
0
        // TODO: [REMOVE] - verify that is unused
        // instantiate a transition prefab and fade on/off, alter the text and fade on/off
        public static void PlayTransition(TransitionFader transitionPrefab, string nextLevelName)
        {
            if (transitionPrefab != null)
            {
                transitionPrefab.GetComponentInChildren <Text>().text = nextLevelName;

                TransitionFader instance = Instantiate(transitionPrefab, Vector3.zero, Quaternion.identity);
                instance.Play();
            }
        }
Exemplo n.º 11
0
        // instantiate a transition prefab, alter the text and fade on/off
        public static void PlayTransition(TransitionFader transitionPrefab, int nextLevelNumber)
        {
            if (transitionPrefab != null)
            {
                //transitionPrefab.GetComponentInChildren<Text>().text = "LEVEL " + nextLevelNumber;

                TransitionFader instance = Instantiate(transitionPrefab, Vector3.zero, Quaternion.identity);
                instance.Play();
            }
        }
Exemplo n.º 12
0
        // start the transition and play the first level
        private IEnumerator OnPlayPressedRoutine()
        {
            TransitionFader.PlayTransition(startTransitionPrefab, "In The Beginning...");
            yield return(new WaitForSeconds(_playDelay));

            if (PlayerController.Instance != null)
            {
                PlayerController.Instance.UnfreezePlayer();
            }
            LevelLoader.LoadNextLevel();
            GameMenu.Open();
            _active = false;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Routine that starts the transition between the Main menu and the game loading
        /// the first level on the scenes in build.
        /// </summary>
        /// <returns>An IEnumerator ready to be used as a Coroutine.</returns>
        IEnumerator OnPlayPressedRoutine()
        {
            // start the transition between scenes
            if (_startTransitionPrefab != null)
            {
                TransitionFader.CreateAndPlayTransition(_startTransitionPrefab);
            }

            // load the first level
            if (GameManager.Instance != null)
            {
                LevelLoader.LoadNextLevel();
            }

            // wait a couple of seconds before hiding this menu and openning the game
            // menu
            yield return(new WaitForSeconds(_playDelay));

            // open the game menu (the one with the button that allows the player
            // to pause the game)
            GameMenu.Open();
        }