void OnHealth(SocketIOEvent socketIOEvent) { print("changing the health"); // get the name of the player whose health changed string data = socketIOEvent.data.ToString(); UserHealthJSON userHealthJSON = UserHealthJSON.CreateFromJSON(data); GameObject p = GameObject.Find(userHealthJSON.name); Health h = p.GetComponent <Health>(); h.currentHealth = userHealthJSON.health; h.OnChangeHealth(); }
void OnHealth(SocketIOEvent socketIOEvent) { print("changing the health"); // 플레이어들의 체력이 변하면 호출된다. string data = socketIOEvent.data.ToString(); UserHealthJSON userHealthJSON = UserHealthJSON.CreateFromJSON(data); GameObject p = GameObject.Find(userHealthJSON.name); Health h = p.GetComponent <Health>(); h.currentHealth = userHealthJSON.health; h.OnChangeHealth(); }