예제 #1
0
 public void Connected()
 {
     room.UDPConnected(ID);
     SendDataUDP.SendConnectionOK(this);
     Global.unconectedPlayersUDP.Remove(this);
     Global.connectedPlayersUDP.Add(this);
 }
예제 #2
0
 public void UpdateTimerCallback(object o)
 {
     for (int i = 0; i < roomPlayers.Length; i++)
     {
         if (roomPlayers[i].position.GetValue(out UpdateContainer <float[]> position, out int posIndex))
         {
             SendDataUDP.SendPositonUpdate(this, ObjectType.player, i, position.value, posIndex);
         }
         if (roomPlayers[i].rotation.GetValue(out UpdateContainer <float[]> rotation, out int rotIndex))
         {
             SendDataUDP.SendRotationUpdate(this, ObjectType.player, i, rotation.value, rotIndex);
         }
         if (roomPlayers[i].healthPoints.GetValue(out UpdateContainer <int> health, out int hpIndex))
         {
             SendDataUDP.SendHealthUpdate(this, ObjectType.player, i, health.value, hpIndex);
         }
         if (roomPlayers[i].synergyPoints.GetValue(out UpdateContainer <int> synergy, out int snIndex))
         {
             SendDataUDP.SendSynergyUpdate(this, ObjectType.player, i, synergy.value, snIndex);
         }
     }
     for (int i = 0; i < dynamicObjectsList.Length; i++)
     {
         if (dynamicObjectsList.Get(i) != null)
         {
             try
             {
                 if (dynamicObjectsList.Get(i).position.GetValue(out UpdateContainer <float[]> position, out int posIndex))
                 {
                     SendDataUDP.SendPositonUpdate(this, ObjectType.spell, i, position.value, posIndex);
                 }
                 if (dynamicObjectsList.Get(i).rotation.GetValue(out UpdateContainer <float[]> rotation, out int rotIndex))
                 {
                     SendDataUDP.SendRotationUpdate(this, ObjectType.spell, i, rotation.value, rotIndex);
                 }
                 if (dynamicObjectsList.Get(i).healthPoints.GetValue(out UpdateContainer <int> health, out int hpIndex))
                 {
                     SendDataUDP.SendHealthUpdate(this, ObjectType.spell, i, health.value, hpIndex);
                 }
             }
             catch (Exception e)
             {
                 if (e is IndexOutOfRangeException || e is NullReferenceException)
                 {
                     Global.serverForm.Debug("Ex while spell tick");
                 }
                 else
                 {
                     throw e;
                 }
             }
         }
     }
 }