// 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; } } } }
void Start() { tcp = new TCP(); tcp.Begin(IpAddress, PORT); character = GameObject.Find("Character"); }