コード例 #1
0
        public void Deserialize(Buffer buffer)
        {
            int length = Buffer.Get <int>(buffer);

            for (int i = 0; i < length; i++)
            {
                StoredTransform transform = new StoredTransform();
                transform.networkId        = Buffer.Get <uint>(buffer);
                transform.localPosition    = DeserializeVector3(buffer);
                transform.localEulerAngles = DeserializeVector3(buffer);
                transform.localScale       = DeserializeVector3(buffer);
                transforms.Add(transform);
            }
        }
コード例 #2
0
 public static void BuildMessage(InputTransformationMessage message)
 {
     foreach (KeyValuePair <NetworkInstanceId, NetworkIdentity> networkIdentity in NetworkServer.objects)
     {
         if (networkIdentity.Value.gameObject.GetComponent <Rigidbody>() != null || networkIdentity.Value.gameObject.GetComponent <ForceSynchronization>() != null)
         {
             StoredTransform transform = new StoredTransform();
             transform.networkId        = networkIdentity.Key.Value;
             transform.localPosition    = networkIdentity.Value.gameObject.transform.localPosition;
             transform.localEulerAngles = networkIdentity.Value.gameObject.transform.localEulerAngles;
             transform.localScale       = networkIdentity.Value.gameObject.transform.localScale;
             message.transforms.Add(transform);
         }
     }
 }