internal override void KeyDown(VirtualKeys key) { if (key == VirtualKeys.C1) //Mode Up { if ((int)train.trainModeSelected < train.trainModeCount - 1) { trainModeNew = train.trainModeSelected + 1; train.PlaySound(24, 1, 1, false); } } else if (key == VirtualKeys.C2) //Mode Down { if ((int)train.trainModeSelected > 0) { trainModeNew = train.trainModeSelected - 1; train.PlaySound(24, 1, 1, false); } } }
internal override int?Elapse(ElapseData data) { currentLocation = data.Vehicle.Location; //Calculate signalling status //Distance to next train UpdateAtpSpeeds(data, data.PrecedingVehicle); //Naive overspeed prevention that applies FSB if (train.trainModeActual == Train.TrainModes.CodedManual) { if (data.Vehicle.Speed.KilometersPerHour > train.atpSafetySpeed) { return(-train.specs.BrakeNotches); } else if (data.Vehicle.Speed.KilometersPerHour > train.atpSafetySpeed - ATP_OVERSPEED_COAST_THRESHOLD) { return(0); } if (data.Vehicle.Speed.KilometersPerHour > train.atpSafetySpeed - ATP_OVERSPEED_ALERT_THRESHOLD) { //play sound if (atpOverspeedSoundHandle == null) { atpOverspeedSoundHandle = train.PlaySound(0, 1, 1, true); } } else { if (atpOverspeedSoundHandle != null) { atpOverspeedSoundHandle.Stop(); atpOverspeedSoundHandle = null; } } } return(null); //Check trip count //Check for speed limits //ElapseTripTimer(data); //Is train in RM? /*if (train.trainModeActual == Train.TrainModes.RestrictedManualForward || * train.trainModeActual == Train.TrainModes.RestrictedManualReverse || * train.trainModeActual == Train.TrainModes.Off) * { * atpState = AtpStates.Off; * } * else * { * switch (atpState) * { * case AtpStates.Active: * if (atpTripTimer <= 0.0) * { * atpState = AtpStates.Tripped; * } * return null; * case AtpStates.Tripped: * * return -train.specs.BrakeNotches - 1; * default: * return null; * } * }*/ }