Ejemplo n.º 1
0
    public void GameOver()
    {
        if (over == 0)
        {
            /*GameCenter.GetComponent<Animator>().Play("GameCenter");
             * Settings.GetComponent<Animator>().Play("Settings");
             * PlayButton.GetComponent<Animator>().Play("Play");*/
            HealthBar.GetComponent <Animator>().Play("HealthBarReverse", -1, 0);

            Color1.GetComponent <Animator>().Play("Colo1Reverse");
            Color2.GetComponent <Animator>().Play("Color2Reverse");
            Color3.GetComponent <Animator>().Play("Color3Reverse");
            if (LeftSpawner != null)
            {
                LeftSpawner.CancelInvoke();
                RightSpawner.CancelInvoke();
            }
            else if (left != null)
            {
                left.CancelInvoke();
                right.CancelInvoke();
            }
            else
            {
                doubleSpawner.CancelInvoke();
            }

            LeftPlayer.CancelInvoke();
            RightPlayer.CancelInvoke();

            if (LeftPlayer1 != null)
            {
                LeftPlayer1.CancelInvoke();
                RightPlayer1.CancelInvoke();
                LeftPlayer2.CancelInvoke();
                RightPlayer2.CancelInvoke();
            }

            plane.Play("game-end", -1, 0);
            leaderboard.gameObject.SetActive(true);
            leaderboard.Play("leaderboard-in");
            volume.gameObject.SetActive(true);
            volume.Play("volume-in");
            PlayButton.gameObject.SetActive(true);
            PlayButton.Play("play-in");
            leftSide.gameObject.SetActive(true);
            leftSide.Play("leftSideIn");
            //score.Play("ScoreOut");
            //highScore.Play("highScoreOut");
            SuperButton.Play("SuperOut");
            pause.Play("PauseOut");
            cc.EnableStars();
            //plane.Play("PlanePositionReverse");
            over++;

            if (flood != null)
            {
                flood.Stop();
            }

            if (ct != null)
            {
                ct.GameOver();
            }

            if (Color11 != null)
            {
                Color11.GetComponent <Animator>().Play("Colo1Reverse", -1, 0f);
                Color22.GetComponent <Animator>().Play("Color2Reverse", -1, 0f);
                Color33.GetComponent <Animator>().Play("Color3Reverse", -1, 0f);

                if (SuperButton1 != null)
                {
                    SuperButton1.Play("SuperOut", -1, 0);
                    int score = PlayerPrefs.GetInt("highScore_6_2", 0);
                    score++;
                    PlayerPrefs.SetInt("highScore_6_2", score);
                }
            }
        }
    }