Esempio n. 1
0
		/// <summary>
		/// 从字节数组里读取 Vector3
		/// </summary>
		/// <param name="buffer"> 字节数组 </param>
		/// <param name="offset"> 从字节数组里开始读取的下标, 操作完成后增加 12 </param>
		/// <returns> 读取的 Vector3 值 </returns>
		public static Vector3 ReadVector3FromBuffer(IList<byte> buffer, ref int offset)
		{
			Vector3 value = new Vector3();
			Union8 union = new Union8();

			union.ReadFloatFrom(buffer, ref offset);
			value.x = union.floatValue;

			union.ReadFloatFrom(buffer, ref offset);
			value.y = union.floatValue;

			union.ReadFloatFrom(buffer, ref offset);
			value.z = union.floatValue;

			return value;
        }
Esempio n. 2
0
		/// <summary>
		/// 从字节数组里读取 Quaternion
		/// </summary>
		/// <param name="buffer"> 字节数组 </param>
		/// <param name="offset"> 从字节数组里开始读取的下标, 操作完成后增加 16 </param>
		/// <returns> 读取的 Quaternion 值 </returns>
		public static Quaternion ReadQuaternionFromBuffer(IList<byte> buffer, ref int offset)
		{
			Quaternion value = new Quaternion();
			Union8 union = new Union8();

			union.ReadFloatFrom(buffer, ref offset);
			value.x = union.floatValue;

			union.ReadFloatFrom(buffer, ref offset);
			value.y = union.floatValue;

			union.ReadFloatFrom(buffer, ref offset);
			value.z = union.floatValue;

			union.ReadFloatFrom(buffer, ref offset);
			value.w = union.floatValue;

			return value;
		}