void OnDataRecieved(string data) { if (player.kills <= lastKills && player.deaths <= lastDeaths) { return; } int killsSinceLast = player.kills - lastKills; int deathsSinceLast = player.deaths = lastDeaths; int kills = DataTranslater.DataToKill(data); int deaths = DataTranslater.DataToDeaths(data); int newKills = killsSinceLast + kills; int newDeaths = deathsSinceLast + deaths; string newData = DataTranslater.VAluesToData(newKills, newDeaths); Debug.Log("Syncing: " + newData); lastKills = player.kills; lastDeaths = player.deaths; UserAccountManager.instance.SendData(newData); }
void OnReceivedData(string data) { if (killCount == null || deathCount == null) { return; } killCount.text = DataTranslater.DataToKill(data).ToString() + " kills"; deathCount.text = DataTranslater.DataToDeaths(data).ToString() + " deaths"; }