コード例 #1
0
    public void GoToThisScene()
    {
        switch (sceneName)
        {
        case "Level1":
            BGMMenu.Get().stopMenuMusic();
            LoaderManager.Get().LoadScene(sceneName);
            UILoadingScreen.Get().SetVisible(true);
            break;

        case "Level2":
            BGMMenu.Get().stopMenuMusic();
            LoaderManager.Get().LoadScene(sceneName);
            UILoadingScreen.Get().SetVisible(true);
            break;

        case "GameOver":
            SceneManager.LoadScene(sceneName);
            break;

        case "Menu":
            if (SceneManager.GetActiveScene().name == "GameOver")
            {
                BGMMenu.Get().playMenuMusic();
            }
            SceneManager.LoadScene(sceneName);
            break;

        case "Controls":
            SceneManager.LoadScene(sceneName);
            break;

        case "Credits":
            SceneManager.LoadScene(sceneName);
            break;

        default:
            if (isLevelRestartButton)
            {
                SceneManager.LoadScene(SaveLastLevel.Get().loadLevelName());
            }
            else
            {
                SceneManager.LoadScene(sceneName);
            }
            break;
        }
    }
コード例 #2
0
 private void checkNextScene()
 {
     if (waitingTimer >= waitingTime)
     {
         if (!playerDied)
         {
             if (SceneManager.GetActiveScene().name == "Level2")
             {
                 if (BGMMenu.Get())
                 {
                     BGMMenu.Get().playMenuMusic();
                 }
             }
             SceneManager.LoadScene(nextSceneName);
         }
         else
         {
             SceneManager.LoadScene("GameOver");
         }
     }
 }