コード例 #1
0
    public void RpcSendButton()
    {
        if (gameManager == null)
        {
            GameObject gameManagerObject = GameObject.Find("Game Manager");
            gameManager = gameManagerObject.GetComponent <GameManagerScript> ();
        }

        GameObject signalCircleOrig = GameObject.Find("Signal Circle Original");

        GameObject        signalMessageFind = GameObject.Find("Signal Circle From Partner");
        GameManagerScript gameManagerFind   = GameObject.Find("Game Manager").GetComponent <GameManagerScript> ();


        if (signalCircleOrig.tag == "Signal Wheel One" && gameManagerFind.playerTurn == 2)
        {
            Image wedgeWheel1 = signalMessageFind.transform.GetChild(0).gameObject.GetComponent <Image> ();
            Image wedgeWheel2 = signalMessageFind.transform.GetChild(1).gameObject.GetComponent <Image> ();
            Image wedgeWheel3 = signalMessageFind.transform.GetChild(2).gameObject.GetComponent <Image> ();

            wedgeWheel1.color = gameManagerFind.wedge1;
            wedgeWheel2.color = gameManagerFind.wedge2;
            wedgeWheel3.color = gameManagerFind.wedge3;
        }

        if (signalCircleOrig.tag == "Signal Wheel Two" && gameManagerFind.playerTurn == 1)
        {
            Image wedgeWheel1 = signalMessageFind.transform.GetChild(0).gameObject.GetComponent <Image> ();
            Image wedgeWheel2 = signalMessageFind.transform.GetChild(1).gameObject.GetComponent <Image> ();
            Image wedgeWheel3 = signalMessageFind.transform.GetChild(2).gameObject.GetComponent <Image> ();

            wedgeWheel1.color = gameManagerFind.wedge1;
            wedgeWheel2.color = gameManagerFind.wedge2;
            wedgeWheel3.color = gameManagerFind.wedge3;
        }

        if (signalCircleOrig.tag == "Signal Wheel One" && gameManagerFind.playerTurn == 1)
        {
            Image wheel1 = signalCircleOrig.transform.GetChild(0).gameObject.GetComponent <Image>();
            Image wheel2 = signalCircleOrig.transform.GetChild(1).gameObject.GetComponent <Image>();
            Image wheel3 = signalCircleOrig.transform.GetChild(2).gameObject.GetComponent <Image>();

            wheel1.color = white;
            wheel2.color = white;
            wheel3.color = white;

            gameManager.BackToWhite();
        }

        if (signalCircleOrig.tag == "Signal Wheel Two" && gameManagerFind.playerTurn == 2)
        {
            Image wheel1 = signalCircleOrig.transform.GetChild(0).gameObject.GetComponent <Image>();
            Image wheel2 = signalCircleOrig.transform.GetChild(1).gameObject.GetComponent <Image>();
            Image wheel3 = signalCircleOrig.transform.GetChild(2).gameObject.GetComponent <Image>();

            wheel1.color = white;
            wheel2.color = white;
            wheel3.color = white;

            gameManager.BackToWhite();
        }
    }