Beispiel #1
0
 //Loads the main scene when called, and unpauses the game, incase it was paused
 public void Play()
 {
     if (!lvlOneDone)
     {
         sceneFader.FadeToScene("Game");
     }
     else
     {
         sceneFader.FadeToScene("Game2");
     }
     Time.timeScale = 1f;
 }
    public void Continue()
    {
        // If the logged in player doesn't have a display name, load the player name entry scene.
        if (string.IsNullOrEmpty(authenticationManager.DisplayName))
        {
            sceneFader.FadeToScene(playerNameEntrySceneToLoad);
        }

        // Otherwise, update stats from the latest game, and load the leaderboards scene.
        else
        {
            statisticsManager.UpdateStatistics(OnUpdateStatisticsResult, OnError);
        }
    }
Beispiel #3
0
 public void ToMainMenu()
 {
     Time.timeScale   = 1;
     Cursor.lockState = CursorLockMode.None;
     Cursor.visible   = true;
     fader.FadeToScene(0);
 }
 public void Restart(bool fullReset = true)
 {
     if (fullReset)
     {
         LevelProgressManager.Reset();
     }
     SceneFader.FadeToScene(SceneManager.GetActiveScene().buildIndex, Color.black);
 }
Beispiel #5
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.CompareTag("Player"))
        {
            GameMaster.Instance.SetReachedLevel();

            sceneFader.FadeToScene(nextLevelName);
        }
    }
    IEnumerator RunGameLoop()
    {
        yield return(StartCoroutine(RunGameStarting()));

        yield return(StartCoroutine(RunGamePlaying()));

        yield return(StartCoroutine(RunGameEnding()));

        Time.timeScale = 1f;
        sceneFader.FadeToScene(nextSceneToLoad);
    }
 public void StartGame()
 {
     //for now, we assume that this is the user's first time if they haven't beaten boot camp
     if (GameProgress.farthestLevel != 0)
     {
         SceneFader.FadeToScene(1, Color.black);              //load main menu
     }
     else
     {
         GetComponent <Animator>().SetTrigger("ShowDifficulty");
     }
 }
 public void ResetGame()
 {
     if (resetConfirmed)
     {
         GameProgress.Reset();
         startingLevel = 0;
         SceneFader.FadeToScene(0, Color.black);              //return to title screen
     }
     else
     {
         resetConfirmed = true;
         UpdateResetButton();
     }
 }
    public void ReturnToMain(int startingLevelId, bool skipsConfirmation)
    {
        if (!skipsConfirmation && !hasSeenConfirmation)
        {
            Transform mainMenuButtonParent = gameOverScreen.transform.Find("Window").Find("OldButtons").Find("MainButton");
            mainMenuButtonParent.GetComponent <Image> ().color = Color.red;
            Text buttonText = mainMenuButtonParent.GetComponentInChildren <Text> ();
            buttonText.text     = "Sure?";
            buttonText.color    = Color.white;
            hasSeenConfirmation = true;
            return;
        }

        MainMenu.startingLevel = startingLevelId;
        SceneFader.FadeToScene(1, Color.black);
    }
Beispiel #10
0
 public void Retry()
 {
     Time.timeScale = 1f;
     sceneFader.FadeToScene(SceneManager.GetActiveScene().buildIndex);
 }
 public static void LoadLevel(int levelIndex)
 {
     LevelProgressManager.Reset();
     Spawner.spawners.Clear();
     SceneFader.FadeToScene(levelIndex + 2, Color.black);
 }
Beispiel #12
0
 public void levelLoad()
 {
     sceneFader.FadeToScene(level);
 }
Beispiel #13
0
 public void ReturnToMainMenu()
 {
     fader.FadeToScene(0);
     Cursor.lockState = CursorLockMode.None;
     Cursor.visible   = true;
 }
Beispiel #14
0
    // display the winner and give option to restart the game
    IEnumerator ShowRestartOption(int winnerInt)
    {
        Color fadeColor = Color.white;

        fadeColor.a = 0;

        Color fadeBackColor = restartSprite[0].color;

        fadeBackColor.a = 0;

        Color winnerFadeColor = Color.white;

        winnerFadeColor.a = 0;

        Color buttonTextColor = buttonRestartText.color;

        buttonTextColor.a = 0;

        buttonRestartText.color      = buttonMenuText.color = buttonTextColor;
        buttonRestartRend.color      = buttonMenuRend.color = buttonAudioRend.color = fadeColor;
        restartSprite[0].color       = restartSprite[2].color = fadeBackColor;
        buttonRestartRend.enabled    = buttonRestartText.enabled = buttonMenuRend.enabled = buttonMenuText.enabled = buttonAudioRend.enabled =
            restartSprite[0].enabled = restartSprite[2].enabled = true;

        if (winnerInt > 0)
        {
            StopCoroutine("TimerUpdate");
            StopCoroutine("StartTheGame");
            StopCoroutine("AdvanceZone");
            StartCoroutine("SlowDownTime");

            /*
             * // multiplayer
             * if (GameMode.curPlayers > 1)
             * {
             *      restartSprite[1].color = fadeColor;
             *      restartSprite[1].enabled = true;
             *
             *      winnerFadeColor = winnerSprite[winnerInt - 1].color;
             *      winnerFadeColor.a = 0;
             *      winnerSprite[winnerInt - 1].color = winnerFadeColor;
             *
             *      winnerSprite[winnerInt - 1].enabled = true;
             * }
             * // single player
             * else
             * {*/
            gameOverRend.color   = fadeColor;
            gameOverRend.enabled = true;
            //}
        }

        else
        {
            pausedRend.color   = fadeColor;
            pausedRend.enabled = true;
        }

        for (float t = 0; t < 0.5f; t += Time.deltaTime)
        {
            buttonTextColor.a       = fadeColor.a = fadeBackColor.a = winnerFadeColor.a = 2 * t;
            buttonRestartRend.color = buttonMenuRend.color = buttonAudioRend.color = fadeColor;
            buttonRestartText.color = buttonMenuText.color = buttonTextColor;

            restartSprite[0].color = fadeBackColor;
            fadeBackColor.a        = t / 2;
            restartSprite[2].color = fadeBackColor;

            if (winnerInt > 0)
            {
                /*if (GameMode.curPlayers > 1)
                 * {
                 *      winnerSprite[winnerInt - 1].color = winnerFadeColor;
                 *      restartSprite[1].color = fadeColor;
                 * }
                 * else*/
                gameOverRend.color = fadeColor;
            }
            else
            {
                pausedRend.color = fadeColor;
            }

            yield return(null);
        }

        buttonRestart.collider.enabled = buttonMenu.collider.enabled = true;

        // loop until the user choose to restart the level or return to menu
        while (true)
        {
            if (winnerInt <= 0 && isPaused && Input.GetKeyDown(KeyCode.Escape))
            {
                buttonRestart.collider.enabled = buttonMenu.collider.enabled = false;

                buttonRestartRend.enabled    = buttonRestartText.enabled = buttonMenuRend.enabled = buttonMenuText.enabled = buttonAudioRend.enabled =
                    restartSprite[0].enabled = restartSprite[2].enabled = pausedRend.enabled = false;

                isPaused = false;
                break;
            }
            else if (Input.GetMouseButtonDown(0))
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, 100))
                {
                    if (hit.collider.gameObject == buttonMenu)
                    {
                        AudioSource.PlayClipAtPoint(clickButtonAudio, Vector3.zero);
                        sceneFader.FadeToScene(0);
                        break;
                    }
                    else if (hit.collider.gameObject == buttonRestart)
                    {
                        GameMode.startingLevel = Mathf.Max(zoneInt - 1, 0);

                        AudioSource.PlayClipAtPoint(clickButtonAudio, Vector3.zero);
                        sceneFader.FadeToScene(Application.loadedLevel);

                        break;
                    }
                    else if (hit.collider.gameObject.name.Equals("ButtonMute"))
                    {
                        if (GameMode.globalVolume != 0)
                        {
                            AudioListener.volume   = 0;
                            GameMode.globalVolume  = 0;
                            buttonAudioRend.sprite = audioMuteSprite;
                        }
                        else
                        {
                            AudioListener.volume   = 1;
                            GameMode.globalVolume  = 1;
                            buttonAudioRend.sprite = audioUnmuteSprite;
                        }
                    }

                    // unpause on a touch device
                    else if (winnerInt <= 0 && isPaused)
                    {
                        buttonRestart.collider.enabled = buttonMenu.collider.enabled = false;

                        buttonRestartRend.enabled    = buttonRestartText.enabled = buttonMenuRend.enabled = buttonMenuText.enabled = buttonAudioRend.enabled =
                            restartSprite[0].enabled = restartSprite[2].enabled = pausedRend.enabled = false;

                        isPaused = false;
                        break;
                    }
                }
                // unpause on a touch device
                else if (winnerInt <= 0 && isPaused)
                {
                    buttonRestart.collider.enabled = buttonMenu.collider.enabled = false;

                    buttonRestartRend.enabled    = buttonRestartText.enabled = buttonMenuRend.enabled = buttonMenuText.enabled = buttonAudioRend.enabled =
                        restartSprite[0].enabled = restartSprite[2].enabled = pausedRend.enabled = false;

                    isPaused = false;
                    break;
                }
            }

            yield return(null);
        }
    }
Beispiel #15
0
 // Loads next scene (should be first level) with a fade effect
 void OnTriggerEnter(Collider other)
 {
     fader.FadeToScene(0);
     Cursor.lockState = CursorLockMode.None;
     Cursor.visible   = true;
 }
 public void Play()
 {
     sceneFade.FadeToScene(LeveltoLoad);
 }
Beispiel #17
0
 public void PlayGame()
 {
     sceneFader.FadeToScene(firstLevelSceneName);
 }
Beispiel #18
0
 //Restarts the current scene
 public void TryAgain()
 {
     sceneFader.FadeToScene(SceneManager.GetActiveScene().name);
 }
 public void Continue()
 {
     sceneFader.FadeToScene(titleSceneToLoad);
 }
 public void ChooseDifficulty(int difficulty)
 {
     GameSettings.difficulty = difficulty;
     SceneFader.FadeToScene(2, Color.black);          //load boot camp
 }
 public void Retry()
 {
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
     sceneFade.FadeToScene(SceneManager.GetActiveScene().name);
 }
Beispiel #22
0
 //Restarts the scene at the current buildindex, i.e. the current active scene, and closes the menu
 //Uses the scenefader class to do this
 public void Restart()
 {
     ToggleMenu();
     sceneFader.FadeToScene(SceneManager.GetActiveScene().name);
 }
Beispiel #23
0
 public void Retry() => sceneFader.FadeToScene(SceneManager.GetActiveScene().buildIndex);
 // Loads next scene (should be third level) with a fade effect
 void OnTriggerEnter(Collider collider)
 {
     fader.FadeToScene(SceneManager.GetActiveScene().buildIndex + 1);
 }
    public void LoadLevel(int index)
    {
        audioButtons.Play();

        sf.FadeToScene(index);
    }
Beispiel #26
0
 public void Play()
 {
     AnalyticsEvent.FirstInteraction();
     sceneFader.FadeToScene(gameSceneName);
 }
Beispiel #27
0
 public void RestartGame()
 {
     StartCoroutine(sceneFader.FadeToScene(1));
 }
Beispiel #28
0
    IEnumerator waitForLevel()
    {
        yield return(new WaitForSeconds(3));

        sceneFader.FadeToScene(nextLevel);
    }
Beispiel #29
0
 // Loads next scene (should be first level) with a fade effect
 public void Play()
 {
     fader.FadeToScene(SceneManager.GetActiveScene().buildIndex + 1);
 }
Beispiel #30
0
 public void Play() => sceneFader.FadeToScene(GameManager.Scenes.LevelSelect);