Esempio n. 1
0
 private void UpdateClientWithOwnState(TcpClient client)
 {
     try
     {
         if (client.Connected)
         {
             foreach (TankController t in sim.tankControllers)
             {
                 if (t.Token == GetTokenFromEndpoint(client))
                 {
                     var obj  = GameSimulation.CreateTankState(t);
                     var json = JsonUtility.ToJson(obj);
                     SendMessage(client, MessageFactory.CreateObjectUpdateMessage(json));
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }