OnStartClient() private method

private OnStartClient ( ) : void
return void
        static void ApplySpawnPayload(NetworkIdentity uv, Vector3 position, byte[] payload, NetworkInstanceId netId, GameObject newGameObject, string data = "")
        {
            if (!uv.gameObject.activeSelf)
            {
                uv.gameObject.SetActive(true);
            }
            uv.transform.position = position;
            if (payload != null && payload.Length > 0)
            {
                var payloadReader = new NetworkReader(payload);
                uv.OnUpdateVars(payloadReader, true);
            }
            if (newGameObject == null)
            {
                return;
            }

            newGameObject.SetActive(true);
            uv.SetNetworkInstanceId(netId);
            SetLocalObject(netId, newGameObject);

            // objects spawned as part of initial state are started on a second pass
            if (s_IsSpawnFinished)
            {
                uv.OnStartClient();
                CheckForOwner(uv);
            }
        }
Example #2
0
 private static void OnObjectSpawnFinished(NetworkMessage netMsg)
 {
     netMsg.ReadMessage <ObjectSpawnFinishedMessage>(ClientScene.s_ObjectSpawnFinishedMessage);
     if (LogFilter.logDebug)
     {
         Debug.Log((object)("SpawnFinished:" + (object)ClientScene.s_ObjectSpawnFinishedMessage.state));
     }
     if ((int)ClientScene.s_ObjectSpawnFinishedMessage.state == 0)
     {
         ClientScene.PrepareToSpawnSceneObjects();
         ClientScene.s_IsSpawnFinished = false;
     }
     else
     {
         using (Dictionary <NetworkInstanceId, NetworkIdentity> .ValueCollection.Enumerator enumerator = ClientScene.objects.Values.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 NetworkIdentity current = enumerator.Current;
                 if (!current.isClient)
                 {
                     current.OnStartClient();
                     ClientScene.CheckForOwner(current);
                 }
             }
         }
         ClientScene.s_IsSpawnFinished = true;
     }
 }
Example #3
0
 private static void ApplySpawnPayload(NetworkIdentity uv, Vector3 position, byte[] payload, NetworkInstanceId netId, GameObject newGameObject)
 {
     if (!uv.gameObject.activeSelf)
     {
         uv.gameObject.SetActive(true);
     }
     uv.transform.position = position;
     if (payload != null && payload.Length > 0)
     {
         NetworkReader reader = new NetworkReader(payload);
         uv.OnUpdateVars(reader, true);
     }
     if ((Object)newGameObject == (Object)null)
     {
         return;
     }
     newGameObject.SetActive(true);
     uv.SetNetworkInstanceId(netId);
     ClientScene.SetLocalObject(netId, newGameObject);
     if (!ClientScene.s_IsSpawnFinished)
     {
         return;
     }
     uv.OnStartClient();
     ClientScene.CheckForOwner(uv);
 }
Example #4
0
 private static void ApplySpawnPayload(NetworkIdentity uv, Vector3 position, byte[] payload, NetworkInstanceId netId, GameObject newGameObject)
 {
     uv.transform.position = position;
     if (payload != null && payload.Length > 0)
     {
         NetworkReader reader = new NetworkReader(payload);
         uv.OnUpdateVars(reader, initialState: true);
     }
     if (!(newGameObject == null))
     {
         newGameObject.SetActive(value: true);
         uv.SetNetworkInstanceId(netId);
         SetLocalObject(netId, newGameObject);
         if (s_IsSpawnFinished)
         {
             uv.OnStartClient();
             CheckForOwner(uv);
         }
     }
 }
 private static void ApplySpawnPayload(NetworkIdentity uv, Vector3 position, byte[] payload, NetworkInstanceId netId, GameObject newGameObject)
 {
   if (!uv.gameObject.activeSelf)
     uv.gameObject.SetActive(true);
   uv.transform.position = position;
   if (payload != null && payload.Length > 0)
   {
     NetworkReader reader = new NetworkReader(payload);
     uv.OnUpdateVars(reader, true);
   }
   if ((Object) newGameObject == (Object) null)
     return;
   newGameObject.SetActive(true);
   uv.SetNetworkInstanceId(netId);
   ClientScene.SetLocalObject(netId, newGameObject);
   if (!ClientScene.s_IsSpawnFinished)
     return;
   uv.OnStartClient();
   ClientScene.CheckForOwner(uv);
 }
Example #6
0
 private static void ApplySpawnPayload(NetworkIdentity uv, Vector3 position, byte[] payload, NetworkInstanceId netId, GameObject newGameObject)
 {
     uv.transform.position = position;
     if ((payload != null) && (payload.Length > 0))
     {
         NetworkReader reader = new NetworkReader(payload);
         uv.OnUpdateVars(reader, true);
     }
     if (newGameObject != null)
     {
         newGameObject.SetActive(true);
         uv.SetNetworkInstanceId(netId);
         SetLocalObject(netId, newGameObject);
         if (s_IsSpawnFinished)
         {
             uv.OnStartClient();
             CheckForOwner(uv);
         }
     }
 }