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