예제 #1
0
 //!
 //! Called from spawned players when client is connected and after ownership message from server arrived
 //!
 public void RegisterPlayer(NetworkPlayerBase player)
 {
     if (userNotPresent)
     {
         userNotPresent.SetActive(false);
     }
     player.OnPlayerRestingChanged.AddListener(handlePlayerResting);
 }
예제 #2
0
 //!
 //! On all spawned players call ForceRotation
 //! TODO make a generic function
 //! @param		rot		rotation to be set
 //!
 public void RpcCallToAll(Quaternion rot)
 {
     foreach (KeyValuePair <NetworkInstanceId, NetworkIdentity> pair in NetworkServer.objects)
     {
         if (pair.Value.gameObject != null)
         {
             NetworkPlayerBase player = pair.Value.gameObject.GetComponent <NetworkPlayerBase>();
             if (player != null)
             {
                 player.ForceRotationOnClient(rot);
             }
         }
     }
 }