UNetSerializeAllVars() 개인적인 메소드

private UNetSerializeAllVars ( NetworkWriter writer ) : void
writer NetworkWriter
리턴 void
예제 #1
0
 internal void SendSpawnMessage(NetworkIdentity uv, NetworkConnection conn)
 {
     if (uv.serverOnly)
     return;
       if (uv.sceneId.IsEmpty())
       {
     ObjectSpawnMessage objectSpawnMessage = new ObjectSpawnMessage();
     objectSpawnMessage.netId = uv.netId;
     objectSpawnMessage.assetId = uv.assetId;
     objectSpawnMessage.position = uv.transform.position;
     NetworkWriter writer = new NetworkWriter();
     uv.UNetSerializeAllVars(writer);
     if ((int) writer.Position > 0)
       objectSpawnMessage.payload = writer.ToArray();
     if (conn != null)
       conn.Send((short) 3, (MessageBase) objectSpawnMessage);
     else
       NetworkServer.SendToReady(uv.gameObject, (short) 3, (MessageBase) objectSpawnMessage);
     NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short) 3, uv.assetId.ToString(), 1);
       }
       else
       {
     ObjectSpawnSceneMessage spawnSceneMessage = new ObjectSpawnSceneMessage();
     spawnSceneMessage.netId = uv.netId;
     spawnSceneMessage.sceneId = uv.sceneId;
     spawnSceneMessage.position = uv.transform.position;
     NetworkWriter writer = new NetworkWriter();
     uv.UNetSerializeAllVars(writer);
     if ((int) writer.Position > 0)
       spawnSceneMessage.payload = writer.ToArray();
     if (conn != null)
       conn.Send((short) 10, (MessageBase) spawnSceneMessage);
     else
       NetworkServer.SendToReady(uv.gameObject, (short) 3, (MessageBase) spawnSceneMessage);
     NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short) 10, "sceneId", 1);
       }
 }