コード例 #1
0
ファイル: GameUI.cs プロジェクト: hectoram/CS113
    // Use this for initialization
    void Start()
    {
        startTimer = false;

        menuObject = GameObject.FindGameObjectWithTag("Menus");
        menu = menuObject.GetComponent<GameOverScript>();

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        score1Panel = GameObject.Find("Score 1 Panel");
        score2Panel = GameObject.Find("Score 2 Panel");
        score3Panel = GameObject.Find("Score 3 Panel");
        score4Panel = GameObject.Find("Score 4 Panel");

        temp1.Set(0, 6, 0);

        timeText.transform.position = temp1;

        if (clientManager.getNumberOfPlayers() == "2")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);

            score1Pos.Set(-3, 7, 0);
            score2Pos.Set(3, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
        }
        else if (clientManager.getNumberOfPlayers() == "3")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);
            score3Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 3 PANEL: X = " + score3Panel.transform.position.x + " Y = " + score3Panel.transform.position.y);

            score1Pos.Set(-5, 7, 0);
            score2Pos.Set(0, 7, 0);
            score3Pos.Set(5, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
            score3Panel.transform.position = score3Pos;
        }
        else if (clientManager.getNumberOfPlayers() == "4")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);
            score3Panel.SetActive(true);
            score4Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 3 PANEL: X = " + score3Panel.transform.position.x + " Y = " + score3Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 4 PANEL: X = " + score4Panel.transform.position.x + " Y = " + score4Panel.transform.position.y);

            score1Pos.Set(-7, 7, 0);
            score2Pos.Set(-2, 7, 0);
            score3Pos.Set(2, 7, 0);
            score4Pos.Set(7, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
            score3Panel.transform.position = score3Pos;
            score4Panel.transform.position = score4Pos;
        }
    }