public void Serialize(ref IntMath.Vector3i v)
 {
     if (isLoading)
     {
         v = ReadVector3i();
     }
     else
     {
         Write(v);
     }
 }
Beispiel #2
0
	public override bool Serialize(Archive archive, ISerializableObjectReferenceCollector collector, ref object field, object lastFieldState) {
		QuantizedVector3Field value = (QuantizedVector3Field)field;

		if (archive.isLoading) {
			IntMath.Vector3i q = new IntMath.Vector3i(
				archive.ReadSignedBits(value.FX.NUM_BITS),
				archive.ReadSignedBits(value.FY.NUM_BITS),
				archive.ReadSignedBits(value.FZ.NUM_BITS));
			value.quantizedValue = q;
		} else {
			IntMath.Vector3i q = value.quantizedValue;
			archive.WriteSignedBits(q.x, value.FX.NUM_BITS);
			archive.WriteSignedBits(q.y, value.FY.NUM_BITS);
			archive.WriteSignedBits(q.z, value.FZ.NUM_BITS);
		}

		field = value;
		return archive.isLoading;
	}
 public virtual void Write(IntMath.Vector3i v)
 {
     Write(v.x);
     Write(v.y);
     Write(v.z);
 }