/// <summary> /// Resets the position of the airplane /// </summary> public void Reset() { iFlightModel.Reset(); iFlightModel.Throttle = 0; iFlightModel.CableEnabled = false; crashTime = 0; if (AircraftParameters.HandLaunched) { if (variometer != null) { variometer.Play(true); } iFlightModel.HandLaunch(-owner.PilotPosition.Z, -owner.PilotPosition.X, -owner.PilotPosition.Y); } else if (AircraftParameters.HasFloats && TakeOffFromWater) { iFlightModel.X = -waterStartPosition.Z; iFlightModel.Y = -waterStartPosition.X; iFlightModel.Z = -waterStartPosition.Y; if (AircraftParameters.HasRetracts) { iFlightModel.GearExtended = false; } } else { iFlightModel.X = -defaultStartPosition.Z; iFlightModel.Y = -defaultStartPosition.X; iFlightModel.Z = -defaultStartPosition.Y; } if ((owner != null) && (owner.InputManager != null)) { prevFlapsChannel = owner.InputManager.GetAxisValue("flaps"); prevGearChannel = owner.InputManager.GetAxisValue("gear"); } airplane.StartEngine(); prevPos = new Vector3(-iFlightModel.Y, -iFlightModel.Z, -iFlightModel.X); }
private void StartPlaying() { if (!string.IsNullOrEmpty(fileName)) { if (playing) { StopPlaying(); } file = File.OpenRead(fileName); binaryReader = new BinaryReader(file); aircraftParameters = new AircraftParameters(); aircraftParameters.ReadParameters(binaryReader.ReadString()); if (airplaneModel == null) { airplaneModel = new AirplaneModel(this); } playing = true; startTime = -1; relativeTime = 0; previousState = new AirplaneState(); nextState = new AirplaneState(); nextTime = binaryReader.ReadDouble(); nextState.Read(binaryReader); currentState.Gear = nextState.Gear; currentState.Flaps = nextState.Flaps; if (currentState.Gear) { Gear = 1.0; } if (currentState.Flaps) { Flaps = 1.0; } airplaneModel.StartEngine(); } }