public Car(IEngine engine, IGearBox gearBox, IOnBoardComputer computer, IDriveTrain driveTrain) { Engine = engine; GearBox = gearBox; Computer = computer; DriveTrain = driveTrain; }
static void PrintGearCombinations(IGearBox gearBox) { foreach (var t in gearBox.Gears) { Console.WriteLine($"Gear ratio {t.Ratio} can be generated by the following combinations"); foreach (int[] combination in t.Combinations) { Console.WriteLine($"\tFront: {combination[0]}, Rear: {combination[1]}"); } } }
public static void AdjustSpeed(float speed, float desiredSpeed, float majorThreshold, float minorThreshold, IGearBox gearBox, IThrottle throttle, IBreaks breaks) { float diff = speed - desiredSpeed; if (diff < -majorThreshold) { gearBox.DownShift(); throttle.Accellerate(); } else if (diff < -minorThreshold) { throttle.Accellerate(); } else if (diff > minorThreshold) { breaks.Engage(); } }
public void setGearBox(IGearBox gearBox) { this.gearBox = gearBox; }
public ManualGearLever(IGearBox gearBox) { GearBox = gearBox; }
public FamilyCar() { _engine = new Engine(4, FuelType.Diesel); _gearBox = new GearBox(4, true); }
public AudiEngine(IGearBox g) { this.gb = g; }
public MercedezEngine(IGearBox g) { this.gb = g; }
public GearShifter(IGearBox gearBox) { _gearBox = gearBox ?? throw new ArgumentNullException(nameof(gearBox)); }
public Car(IEngine engine, IGearBox gearBox) { _engine = engine; _gearBox = gearBox; }
public Dashboard(IGearBox gearBox) { _gearBox = gearBox ?? throw new ArgumentNullException(); }