// Token: 0x060012D1 RID: 4817 RVA: 0x00020884 File Offset: 0x0001EA84 public void SendUpdatePositionAndRotation(ShortVector3 position, ShortVector3 velocity, byte hrot, byte vrot, byte moveState) { using (MemoryStream memoryStream = new MemoryStream()) { ShortVector3Proxy.Serialize(memoryStream, position); ShortVector3Proxy.Serialize(memoryStream, velocity); ByteProxy.Serialize(memoryStream, hrot); ByteProxy.Serialize(memoryStream, vrot); ByteProxy.Serialize(memoryStream, moveState); Dictionary <byte, object> customOpParameters = new Dictionary <byte, object> { { this.__id, memoryStream.ToArray() } }; if (this.sendOperation != null) { this.sendOperation(14, customOpParameters, false, 0, false); } } }
/// <summary> /// Writes the specified vector to the underlying stream. /// </summary> /// <param name="value">The vector value.</param> public static void Write(this BinaryWriter writer, ShortVector3 value) { writer.Write(value.X); writer.Write(value.Y); writer.Write(value.Z); }
// Token: 0x0600109D RID: 4253 RVA: 0x00015448 File Offset: 0x00013648 public static void Serialize(Stream bytes, ShortVector3 instance) { bytes.Write(BitConverter.GetBytes((short)Mathf.Clamp(instance.x * 100f, -32768f, 32767f)), 0, 2); bytes.Write(BitConverter.GetBytes((short)Mathf.Clamp(instance.y * 100f, -32768f, 32767f)), 0, 2); bytes.Write(BitConverter.GetBytes((short)Mathf.Clamp(instance.z * 100f, -32768f, 32767f)), 0, 2); }
/// <summary> /// Unpacks the Vector3 from short. resolution defines the number of decimals places that the vector should have and muust be the same as was used while packing. /// </summary> /// <returns>The vector3 from short.</returns> /// <param name="input">Input.</param> /// <param name="resolution">resolution.</param> public static Vector3 UnpackVector3FromShort(ShortVector3 input, uint resolution) { return(UnpackVector3FromShort(input.x, input.y, input.z, resolution)); }