/// <summary> /// Only Deserialize the stream of data that is not the owner /// </summary> /// <param name="stream">Stream of data to use</param> public override void Deserialize(NetworkingStream stream) { if ((IsOwner && !serverIsAuthority) || (OwningNetWorker.IsServer && serverIsAuthority)) return; stream.ResetByteReadIndex(); targetFrame = stream.FrameIndex; targetPosition = GetNextSerializedTransform(serializePosition, stream, targetPosition); targetRotation = GetNextSerializedTransform(serializeRotation, stream, targetRotation); targetScale = GetNextSerializedTransform(serializeScale, stream, targetScale); if (Properties == null) return; foreach (NetRef<object> obj in Properties) { // Only allow the server to replicate this variable across the network if (obj.serverOnly && !OwningNetWorker.IsServer) { ObjectMapper.Map(obj.Value.GetType(), stream); continue; } if (!interpolateFloatingValues || obj.IgnoreLerp || !DataInitialized) { if (obj.Assign(ObjectMapper.Map(obj.Value.GetType(), stream))) obj.Callback(this, true); } else obj.Lerp(ObjectMapper.Map(obj.Value.GetType(), stream)); } }
/// <summary> /// Only Deserialize the stream of data that is not the owner /// </summary> /// <param name="stream">Stream of data to use</param> public override void Deserialize(NetworkingStream stream) { if ((IsOwner && !serverIsAuthority) || (OwningNetWorker.IsServer && serverIsAuthority)) return; stream.ResetByteReadIndex(); targetPosition = GetNextSerializedTransform(serializePosition, stream, targetPosition); targetRotation = GetNextSerializedTransform(serializeRotation, stream, targetRotation); targetScale = GetNextSerializedTransform(serializeScale, stream, targetScale); if (Properties == null) return; foreach (NetRef<object> obj in Properties) { if (!interpolateFloatingValues) { obj.Value = ObjectMapper.Map(obj.Value.GetType(), stream); obj.Callback(this); } else obj.Lerp(ObjectMapper.Map(obj.Value.GetType(), stream)); } }