Exemple #1
0
 private void ExecuteCommand(NetworkCryptor.NetCommand cmd)
 {
     if (cmd is NetworkCryptor.PlayerInstanceInfo)
     {
         var inf       = (NetworkCryptor.PlayerInstanceInfo)cmd;
         var character = Instantiate(characterPrefab, inf.position, transform.rotation);
         character.netId = inf.id;
         if (connectedCharcters.Count == 0)
         {
             var controller = gameObject.AddComponent <PlayerController>();
             var cam        = ccamera.transform.GetChild(0).GetComponent <Camera>();
             controller.Initialize(character, cam, gClient.connectedClient);
         }
         connectedCharcters.Add(character);
     }
     if (cmd is NetworkCryptor.PlayerMoveToInfo)
     {
         var inf = (NetworkCryptor.PlayerMoveToInfo)cmd;
         DLogger.WriteLineToScreen("Game Admin Move to:");
         Character character = null;
         if (inf != null)
         {
             character = connectedCharcters.Find(fc => fc.netId == inf.id);
             DLogger.WriteLineToScreen("TO: " + " id: " + inf.id + " dest " + inf.destonation);
         }
         if (character != null)
         {
             character.MoveTo(inf.destonation);
         }
     }
     if (cmd is NetworkCryptor.PlayerDestroyInfo)
     {
         var       inf       = (NetworkCryptor.PlayerDestroyInfo)cmd;
         Character character = null;
         if (inf != null)
         {
             character = connectedCharcters.Find(fc => fc.netId == inf.id);
             if (character != null)
             {
                 connectedCharcters.Remove(character);
                 Destroy(character.gameObject);
             }
         }
     }
 }
Exemple #2
0
 public void AddMessageToQueue(NetworkCryptor.NetCommand message)
 {
     messages.Enqueue(message);
 }