예제 #1
0
    IEnumerator NextLevelTransition()
    {
        gameActive = false;
        yield return(new WaitForSeconds(1));

        ScoreDisplayer scoreDisplayer = GetComponent <ScoreDisplayer> ();

        scoreDisplayer.ShowScore();
        yield return(new WaitForSeconds(0.5f));

        for (int i = bombIcons.Length - 1; i >= 0; i--)
        {
            if (bombIcons [i].activeSelf == true)
            {
                UpdateScore(100);
                scoreDisplayer.UpdateBonusBombs(100);
                bombIcons [i].SetActive(false);
                audioController.Play("bonus");
                yield return(new WaitForSeconds(0.2f));
            }
        }

        yield return(new WaitForSeconds(0.5f));

        while (bunniesLeft > 0)
        {
            bunnyIcons [bunniesLeft - 1].SetActive(false);
            bunniesLeft -= 1;
            UpdateScore(100);
            scoreDisplayer.UpdateBonusBunnies(100);
            audioController.Play("bonus");
            yield return(new WaitForSeconds(1));
        }

        yield return(new WaitForSeconds(1));

        scoreDisplayer.HideScore();

        bunniesLeft = bunnyIcons.Length;
        for (int i = 0; i < bunnyIcons.Length; i++)
        {
            bunnyIcons [i].SetActive(true);
        }

        bombsLeft = bombIcons.Length;
        for (int i = 0; i < bombIcons.Length; i++)
        {
            bombIcons [i].SetActive(true);
        }

        yield return(new WaitForSeconds(2));

        gameActive = true;
        StartNextLevel();
    }