// Supposed to be very simple and naive public void HandleEvent(IEvent @event) { switch (@event) { case GasPressureChanged gasPressureChanged: GasPressure = gasPressureChanged.PedalPressure; return; case BrakePressureChanged brakePressureChanged: BrakePressure = brakePressureChanged.PedalPressure; return; case GearChanged gearChanged: CurrentGear = gearChanged.EnteredGear; if (gearChanged.EnteredGear.Value > gearChanged.PreviousGear.Value && _systems.getCurrentRpm() > 1200) { _systems.setCurrentRpm(Math.Max(_systems.getCurrentRpm() - 500, 0)); } if (gearChanged.EnteredGear.Value < gearChanged.PreviousGear.Value) { _systems.setCurrentRpm(Math.Max(_systems.getCurrentRpm() + 200, 0)); } break; case DriveModeEntered _: _systems.setCurrentRpm(1000); break; } }
public Rpm GetCurrentRpm() { var currentRpm = _externalSystems.getCurrentRpm(); return(new Rpm(currentRpm)); }