public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { TargetTransform.SetPosition(base.UseLocalSpace, reader.ReadVector3()); TargetTransform.SetRotation(base.UseLocalSpace, FlexNetworkTransformSerializers.ReadCompressedQuaternion(reader)); TargetTransform.SetScale(reader.ReadVector3()); } base.OnDeserialize(reader, initialState); }
public override bool OnSerialize(NetworkWriter writer, bool initialState) { if (initialState) { writer.WriteVector3(TargetTransform.GetPosition(base.UseLocalSpace)); FlexNetworkTransformSerializers.WriteCompressedQuaternion(writer, TargetTransform.GetRotation(base.UseLocalSpace)); writer.WriteVector3(TargetTransform.GetScale()); } return(base.OnSerialize(writer, initialState)); }
public override bool OnSerialize(NetworkWriter writer, bool initialState) { if (initialState) { /* If root then no need to send transform data as that's already * handled in the spawn message. */ if (transform.root == null) { return(base.OnSerialize(writer, initialState)); } writer.WriteVector3(TargetTransform.GetPosition(base.UseLocalSpace)); FlexNetworkTransformSerializers.WriteCompressedQuaternion(writer, TargetTransform.GetRotation(base.UseLocalSpace)); writer.WriteVector3(TargetTransform.GetScale()); } return(base.OnSerialize(writer, initialState)); }
public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { /* If root then no need to read transform data as that's already * handled in the spawn message. */ if (transform.root == null) { base.OnDeserialize(reader, initialState); return; } TargetTransform.SetPosition(base.UseLocalSpace, reader.ReadVector3()); TargetTransform.SetRotation(base.UseLocalSpace, FlexNetworkTransformSerializers.ReadCompressedQuaternion(reader)); TargetTransform.SetScale(reader.ReadVector3()); } base.OnDeserialize(reader, initialState); }