Esempio n. 1
0
 //Check whether it is a character of the player and turn the player on its index, and gave him the coordinates of movement
 static public void OnPlMove(NetworkMessage netms)
 {
     Message_Sr.PlayerGoTo_Sr Go = netms.ReadMessage <Message_Sr.PlayerGoTo_Sr>();
     if (Networking_OnConnect.AccountVerefication(Go.index, Go.login, Go.password))
     {
         try
         {
             if (Go.keySend)
             {
                 Player_MovePlayer move = GetPlayerController(Go.index);
                 if (move)
                 {
                     move.Newposit(Go.key, Go.down);
                 }
             }
             else
             {
                 Player_MovePlayer move = GetPlayerController(Go.index);
                 if (move)
                 {
                     move.axisY = Go.axisY;
                 }
             }
         }
         catch (UnityException ex)
         {
             Debug.Log(ex.Message);
             Debug.Log("Networking_OnPlayerMove: ERROR");
         }
     }
 }
 //Sync move target
 void SyncMove()
 {
     Message_Sr.PlayerGoTo_Sr run = new Message_Sr.PlayerGoTo_Sr();
     run.index   = index;
     run.sendVec = transform.position;
     run.rotate  = transform.rotation;
     RoomsManager.SendReliableAtRoom(Networking_msgType_Sr.PlayerMove, run, index);
     if (syncMove)
     {
         Invoke("SyncMove", syncTime);
     }
 }