private static void CheckLanding() { if ((fsData.altitude - fsData.groundAltitude) < 1500 && (fsData.altitude - fsData.groundAltitude) > 0 && fsData.verticalSpeed < -400 && fsData.altitude > 0) { changeFlightMode(7, true); EVENTSTIMER.Interval = 100; POSITIONTIMER.Interval = 10000; SoundFactory.PlaySound("Landing"); } }
private static void FMODETIMER_Tick(Object myObject, EventArgs myEventArgs) { if (!FSUIPCProvider.isConnected()) { FSUIPCProvider.CheckConnection(); return; } else { acarsForm.mainForm.setStatus("Connected to FS"); acarsForm.mainForm.setProgress(false); } // tracking logic switch (flightMode) { // boarding case 0: if (!fsData.parkingBrake) { POSITIONTIMER.Interval = 15000; changeFlightMode(1, true); LogFlightEvent("BlockOff", "", 1); initialPitch = fsData.pitch; SoundFactory.PlaySound("TaxiFromGate"); acarsForm.enableButtons(); } break; // taxi from gate case 1: if (fsData.lightsLanding && !playedBeforeTakeoff) { SoundFactory.PlaySound("BeforeTakeoff"); playedBeforeTakeoff = true; } if (fsData.airSpeed > 50) { SoundFactory.StopSound(); changeFlightMode(2, true); EVENTSTIMER.Interval = 100; POSITIONTIMER.Interval = 10000; } break; // departure case 2: CheckClimb(); break; // climb case 3: if (fsData.altitude >= (flightInit.flight_level - 500)) { Logger.LogEvent("TOC", "Top of climb"); LogFlightEvent("TOC", "", 1); LogPosition(); changeFlightMode(4, true); POSITIONTIMER.Interval = 30000; } CheckLanding(); break; // cruise case 4: if (fsData.altitude < (flightInit.flight_level - 1500)) { changeFlightMode(5, true); Logger.LogEvent("TOD", "Top of descent"); LogFlightEvent("TOD", "", 1); LogWeights(); LogPosition(); SoundFactory.PlaySound("Descent"); POSITIONTIMER.Interval = 30000; } CheckLanding(); break; // descend case 5: if (fsData.altitude >= (flightInit.flight_level - 500)) { POSITIONTIMER.Interval = 30000; changeFlightMode(4, true); } if (((fsData.altitude - fsData.groundAltitude) < 10000)) { POSITIONTIMER.Interval = 20000; changeFlightMode(6, true); } CheckLanding(); break; // approach case 6: CheckLanding(); break; // landing case 7: if (fsData.onGround && fsData.groundSpeed <= 25) { changeFlightMode(8, true); EVENTSTIMER.Interval = 5000; POSITIONTIMER.Interval = 30000; SoundFactory.PlaySound("TaxiToGate"); } CheckClimb(); break; // taxi to gate case 8: if (fsData.groundSpeed < 2 && fsData.parkingBrake) { if (timeout < Properties.Settings.Default.parking_brake_timeout) { timeoutRunning = true; timeout++; FSUIPCProvider.sendMessage("Flight will be finished in " + (Properties.Settings.Default.parking_brake_timeout - timeout).ToString() + " seconds", 1); } else { endFlight(); } } else if (timeoutRunning && !fsData.parkingBrake) { timeout = 0; FSUIPCProvider.sendMessage("Parking brake timeout reset", 2); } break; } }