Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        int s = 0;

        scoreText.text = targetZone.score.ToString();

        UpdateProgressBar(targetZone.score);

        if (AllBoxesAtRest())
        {
            // one star
            if (targetZone.score > 80)
            {
                stars.PlayStar(1);
                s = 1;
            }
            else if (stars.GetAnimated(1))
            {
                s = 0;
                stars.RemoveStar(1);
            }

            if (targetZone.score > 90)
            {
                stars.PlayStar(2);
                s = 2;
            }
            else if (stars.GetAnimated(2))
            {
                s = 1;
                stars.RemoveStar(2);
            }

            if (targetZone.score > 99)
            {
                s = 3;
                stars.PlayStar(3);
            }
            else if (stars.GetAnimated(3))
            {
                s = 2;
                stars.RemoveStar(3);
            }

            if (boxes.ThrownBoxes() == maxNumberOfBoxes || s == 3)
            {
                if (s == 0)
                {
                    UI.ShowLoseScene();
                }
                else if (stars.GetAnimatonDone(s))
                {
                    UI.ShowWinScene();
                    Session.SetStars(SceneManager.GetActiveScene().name, s);
                }
            }
        }
    }