示例#1
0
 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);
 }
示例#2
0
 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));
 }
示例#3
0
        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));
        }
示例#4
0
        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);
        }