예제 #1
0
    IEnumerator LevelChanger(int level)
    {
        yield return(new WaitForSeconds(1f));

        switch (level)
        {
        case 1:
            currentLevel = 1;
            DontDestroyOnLoad(gameObject);
            DontDestroyOnLoad(GameObject.Find("MusicController"));
            musicController = GameObject.Find("MusicController").GetComponent <MusicController>();
            SceneManager.LoadScene("Title");
            musicController.Reset();
            musicController.Title();
            break;

        case 2:
            if (currentLevel == 1)
            {
                currentLevel = 2;
                Begin();
            }

            break;

        case 3:
            currentLevel = 3;
            musicController.Nexttrack();
            musicController.Nexttrack();
            PreBattle();
            break;

        case 4:
            currentLevel = 4;
            Battle();
            break;

        case 5:
            musicController.Nexttrack();
            musicController.Nexttrack();
            AfterBattle();
            break;

        case 6:
            currentLevel = 6;
            Platform();
            break;

        case 7:
            currentLevel = 7;
            FinalWarning();
            break;

        case 8:
            currentLevel = 8;
            musicController.Nexttrack();
            musicController.ChangeTrack();
            StartCoroutine(Ending());
            break;

        case 9:
            if (currentLevel != 9)
            {
                musicController.GameOver();
                musicController.ChangeTrack();
                currentLevel = 9;
                Death();
            }
            break;

        case 10:
            Application.Quit();
            break;
        }
    }