コード例 #1
0
    public void ChangeState(Gamestate state)
    {
        this.state = state;

        menuPanel.gameObject.SetActive((this.state == Gamestate.Menu));
        scoreboardPanel.gameObject.SetActive((this.state == Gamestate.GameScore));

        if (this.state == Gamestate.Menu)
        {
            Camera.main.GetComponent <Transform>().position = new Vector3(35, 65, -20);
            Camera.main.GetComponent <Transform>().rotation = Quaternion.Euler(90, 0, 0);
        }
        else if (this.state == Gamestate.Practice)
        {
            practiceCourse.Begin(this, false);
        }
        else if (this.state == Gamestate.Game)
        {
            mainCourse.Begin(this, true);
        }
        else if (this.state == Gamestate.GameScore)
        {
            int total = 0;

            for (int i = 0; i < 12; i++)
            {
                scoreboardText[i].text = mainCourse.holes[mainCourse.randomHoleOrder[i]].score.ToString();
                total += mainCourse.holes[mainCourse.randomHoleOrder[i]].score;
            }

            scoreboardText[12].text = total.ToString();
        }
    }