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); } }
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); } } }