public Car(IEngine engine, IGearBox gearBox, IOnBoardComputer computer, IDriveTrain driveTrain)
 {
     Engine = engine;
     GearBox = gearBox;
     Computer = computer;
     DriveTrain = driveTrain;
 }
Beispiel #2
0
 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();
     }
 }
Beispiel #4
0
 public void setGearBox(IGearBox gearBox)
 {
     this.gearBox = gearBox;
 }
Beispiel #5
0
 public ManualGearLever(IGearBox gearBox)
 {
     GearBox = gearBox;
 }
 public FamilyCar()
 {
     _engine  = new Engine(4, FuelType.Diesel);
     _gearBox = new GearBox(4, true);
 }
Beispiel #7
0
 public AudiEngine(IGearBox g)
 {
     this.gb = g;
 }
Beispiel #8
0
 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;
 }
Beispiel #11
0
 public Dashboard(IGearBox gearBox)
 {
     _gearBox = gearBox ?? throw new ArgumentNullException();
 }