예제 #1
0
    // Update is called once per frame
    void Update()
    {
        string data = tcp.readStr;

        if (!tcp.IsConnected)
        {
            tcp.StopTcpActivity();
            tcp.Begin(IpAddress, PORT);
        }
        else
        {
            bool stringNumerical = int.TryParse(data, out _);
            if (stringNumerical)
            {
            }
            else
            {
                switch (data)
                {
                case "TOO LOUD":
                    character.GetComponent <Animator>().SetBool("IsAngry", true);
                    break;

                case "FINE":
                    character.GetComponent <Animator>().SetBool("IsAngry", false);
                    break;
                }
            }
        }
    }
예제 #2
0
 void Start()
 {
     tcp = new TCP();
     tcp.Begin(IpAddress, PORT);
     character = GameObject.Find("Character");
 }