예제 #1
0
    public void Write()
    {
        if (xplay == true)
        {
            GetComponentInChildren <Text>().text = "X";
            GetComponent <Button>().interactable = false;

            omg.Data[int.Parse(gameObject.name)] = "X";


            if (omg.IsWin("X"))
            {
                omg.panel.SetActive(true);
                MyScore = MyScore + 1;
                GameObject.Find("MyScore").GetComponent <Text>().text = MyScore.ToString();
                return;
            }
            else if (omg.IsDraw())
            {
                omg.ToColorDraw();
                omg.panel.SetActive(true);
            }
            else
            {
                xplay = false;
            }

            xplay = false;
        }
        else
        {
            GetComponentInChildren <Text>().text = "O";
            GetComponent <Button>().interactable = false;

            omg.Data[int.Parse(gameObject.name)] = "O";


            if (omg.IsWin("O"))
            {
                omg.panel.SetActive(true);
                FriendScore = FriendScore + 1;
                GameObject.Find("FriendScore").GetComponent <Text>().text = FriendScore.ToString();
                return;
            }
            else if (omg.IsDraw())
            {
                omg.ToColorDraw();
                omg.panel.SetActive(true);
            }
            else
            {
                xplay = true;
            }

            xplay = true;
        }
    }
예제 #2
0
파일: Go2.cs 프로젝트: B5Happy/TicTacToe
    private void Start()
    {
        rofl = GameObject.Find("ManagerVF").GetComponent <ManagerVF>();


        // Write a message at each case
        if (rofl.IsWin("O"))
        {
            GameObject.Find("Result").GetComponent <Text>().text = "Your friend win! Click to take revenge!";
        }
        else if (rofl.IsWin("X"))
        {
            GameObject.Find("Result").GetComponent <Text>().text = "Ez win! Click to smak again.";
        }
        else
        {
            GameObject.Find("Result").GetComponent <Text>().text = "The game is hard! Click to get more chance.";
        }

        Update();
    }