public static MovementData read(BinaryReader binaryReader) { MovementData newObj = new MovementData(); newObj.movement_timestamp = binaryReader.ReadUInt16(); newObj.server_control_timestamp = binaryReader.ReadUInt16(); newObj.autonomous = binaryReader.ReadByte(); Util.readToAlign(binaryReader); newObj.movementData_Unpack = MovementDataUnpack.read(binaryReader); return(newObj); }
public static MovementDataUnpack read(BinaryReader binaryReader) { MovementDataUnpack newObj = new MovementDataUnpack(); ushort pack_word = binaryReader.ReadUInt16(); newObj.movement_options = (ushort)(pack_word & 0xFF00); newObj.movement_type = (uint)((ushort)(pack_word & 0x00FF)); newObj.style = (uint)command_ids[binaryReader.ReadUInt16()]; switch (newObj.movement_type) { case 0: { newObj.interpretedMotionState = InterpretedMotionState.read(binaryReader); if ((newObj.movement_options & 0x100) != 0) { newObj.stickToObject = binaryReader.ReadUInt32(); } if ((newObj.movement_options & 0x200) != 0) { newObj.standing_longjump = true; } break; } case 6: { newObj.moveToObject = binaryReader.ReadUInt32(); newObj.moveToPos = Position.readOrigin(binaryReader); newObj.movement_params = MovementParameters.read(newObj.movement_type, binaryReader); newObj.my_run_rate = binaryReader.ReadSingle(); break; } case 7: { newObj.moveToPos = Position.readOrigin(binaryReader); newObj.movement_params = MovementParameters.read(newObj.movement_type, binaryReader); newObj.my_run_rate = binaryReader.ReadSingle(); break; } case 8: { newObj.turnToObject = binaryReader.ReadUInt32(); newObj.desiredHeading = binaryReader.ReadSingle(); newObj.movement_params = MovementParameters.read(newObj.movement_type, binaryReader); break; } case 9: { newObj.movement_params = MovementParameters.read(newObj.movement_type, binaryReader); break; } default: { break; } } return(newObj); }