public GearBox(GearBox copy, DieselEngine de) { mstsParams = new MSTSGearBoxParams(copy.mstsParams); DieselEngine = de; if (mstsParams != null) { if ((!mstsParams.IsInitialized) && (mstsParams.AtLeastOneParamFound)) { Trace.TraceWarning("Some of the gearbox parameters are missing! Default physics will be used."); } for (int i = 0; i < mstsParams.GearBoxNumberOfGears; i++) { Gears.Add(new Gear(this)); Gears[i].BackLoadForceN = mstsParams.GearBoxBackLoadForceN; Gears[i].CoastingForceN = mstsParams.GearBoxCoastingForceN; Gears[i].DownGearProportion = mstsParams.GearBoxDownGearProportion; Gears[i].IsDirectDriveGear = (mstsParams.GearBoxDirectDriveGear == mstsParams.GearBoxNumberOfGears); Gears[i].MaxSpeedMpS = mstsParams.GearBoxMaxSpeedForGearsMpS[i]; Gears[i].MaxTractiveForceN = mstsParams.GearBoxMaxTractiveForceForGearsN[i]; Gears[i].OverspeedPercentage = mstsParams.GearBoxOverspeedPercentageForFailure; Gears[i].UpGearProportion = mstsParams.GearBoxUpGearProportion; Gears[i].Ratio = mstsParams.GearBoxMaxSpeedForGearsMpS[i] / DieselEngine.MaxRPM; } GearBoxOperation = mstsParams.GearBoxOperation; OriginalGearBoxOperation = mstsParams.GearBoxOperation; } }
public override Car GetCar() { Engine e = null; switch (configurations.Engine.EngineType) { case EEngine.Diesel: e = new DieselEngine(); break; case EEngine.Petrol: e = new PetrolEngine(); break; case EEngine.Gas: e = new GasEngine(); break; } Car newCar = new CustomizedCar(++_iNumberOfCars) { Engine = e, Model = configurations.Model, Base = new Base(), Breaks = new Breaks(), Electronics = new Electronics(), ExhaustingSystem = new ExhaustingSystem(), }; CarEnhancer enh = new CarEnhancer(); enh.Enhance(newCar, configurations.CarType); return(newCar); }
public static void Main(string[] args) { Person person = new Person { FirstName = "Abc", LastName = "Xyz", DateOfBirth = new DateTime(1992, 11, 16) }; Console.WriteLine("Age is {0}", person.GetAge()); //Static Polymorphism DieselEngine dieselEngine = new DieselEngine(); dieselEngine.Start(); //Dynamic Polymorphism Engine engine = new PetrolEngine(); engine.Start(); Exhaustable exhaustable = new Car(engine); exhaustable.Exhaust(); exhaustable = new PowerGenerator(); exhaustable.Exhaust(); }
public GearBox(GearBox copy, DieselEngine de) { mstsParams = new MSTSGearBoxParams(copy.mstsParams); DieselEngine = de; CopyFromMSTSParams(DieselEngine); }
public Car CreateCar() { int carCost = 0; string model; bool result = false; int nummberOfBody = 0; int nummberOfEngine = 0; ICarBody bodyCar; IEngine engineCar; string enterTheCost = "Enter the cost of the car"; string choseTheBody = "Choose a car body \r\n 1.Coupe \r\n 2.Hatchback \r\n 3.Minivan "; string choseTheEngine = "Choose a car engine \r\n 1.DieselEngine \r\n 2.ElectricalEngine \r\n 3.GasolineEngine "; Console.WriteLine("Enter the name of the car"); model = Console.ReadLine(); InputValidation(result, enterTheCost, ref carCost, 0, 9223372036854000000); InputValidation(result, choseTheBody, ref nummberOfBody, 1, 3); switch (nummberOfBody) { case 1: bodyCar = new Coupе();; break; case 2: bodyCar = new Hatchback();; break; case 3: bodyCar = new Minivan();; break; default: bodyCar = null; break; } InputValidation(result, choseTheEngine, ref nummberOfEngine, 1, 3); switch (nummberOfEngine) { case 1: engineCar = new DieselEngine();; break; case 2: engineCar = new ElectricalEngine();; break; case 3: engineCar = new GasolineEngine();; break; default: engineCar = null; break; } Console.WriteLine(); return(new Car(engineCar, bodyCar, carCost, model, IdOfCar)); }
public override void BuildCar() { Brakes = new DiskBrakes(); Engine = new DieselEngine(); Steering = new PowerSteering(); Transmission = new AutomaticTransmission(); Wheels = new AlloyWheels(); }
public void DieselEngine_Set_Get(uint a) { DieselEngine _suut = new DieselEngine(a); MotorBike _uut = new MotorBike(_suut); Assert.That(_suut.CurThrottle = a, Is.EqualTo(a)); _uut.RunAtHalfSpeed(); Assert.That(_suut.CurThrottle, Is.EqualTo(a / 2)); }
static void Main(string[] args) { IEngine eng1 = new GasEngine(20); IEngine eng2 = new DieselEngine(50); Motorbike m = new Motorbike(eng1); Motorbike m2 = new Motorbike(eng2); m.RunAtHalfSpeed(); m2.RunAtHalfSpeed(); }
public DieselEngine getDieselEngine(string[] items) { DieselEngine dieselEngine = new DieselEngine(); dieselEngine.Power = int.Parse(items[7]); dieselEngine.Manufacturer = items[8]; dieselEngine.DCubes = int.Parse(items[9]); return(dieselEngine); }
public static void Main() { Car ciaz = new Car(); Engine engine = new DieselEngine(); Console.WriteLine(engine.Start()); Console.WriteLine(engine.engineType()); Console.WriteLine(ciaz.Start()); Console.WriteLine(ciaz.Accelerate()); Console.WriteLine(engine.Stop()); Console.WriteLine(ciaz.Stop()); }
public void CarPriceUpdated_WhenISelectEngineAndGearbox() { // Given Car car = new Limousine(); // When car = new DieselEngine(car); car = new AutomaticGearbox(car); // Then Assert.Equal(114200, car.GetCost()); }
static void Main(string[] args) { System.Console.WriteLine("::::::::GasEngine::::::::"); IEngine myGasEngine = new GasEngine(10); MotorBike myGasBike = new MotorBike(myGasEngine); System.Console.WriteLine("Run at half speed."); myGasBike.RunAtHalfSpeed(); System.Console.WriteLine("::::::::DieselEngine:::::"); IEngine myDieEngine = new DieselEngine(20); MotorBike myDieselBike = new MotorBike(myDieEngine); System.Console.WriteLine("Run at half speed."); myDieselBike.RunAtHalfSpeed(); }
static void Main(string[] args) { // ************************************** // // *** Gas engine and gas-driven bike *** // // ************************************** // var myGasEngine = new GasEngine(100); var myGasMotorBike = new MotorBike(myGasEngine); var thr = myGasEngine.CurThrottle; Console.WriteLine($"My gas throttle when idling is: {thr}."); thr = myGasEngine.MaxThrottle; Console.WriteLine($"My gas throttle at full speed is: {thr}"); myGasMotorBike.RunAtHalfSpeed(); thr = myGasEngine.CurThrottle; Console.WriteLine($"My gas throttle at half speed is: {thr}"); // ******************************************** // // *** Diesel engine and diesel-driven bike *** // // ******************************************** // var myDieselEngine = new DieselEngine(120); var myDieselMotorBike = new MotorBike(myDieselEngine); // Diesel-bike outputs: var thr2 = myDieselEngine.CurThrottle; Console.WriteLine($"My diesel throttle when idling is: {thr2}"); thr2 = myDieselEngine.MaxThrottle; Console.WriteLine($"My diesel throttle at full speed is: {thr2}"); myDieselMotorBike.RunAtHalfSpeed(); thr2 = myDieselEngine.CurThrottle; Console.WriteLine($"My diesel throttle at half speed is: {thr2}"); // ************************************************ // // *** Electric engine and electric-driven bike *** // // ************************************************ // var myElectricEngine = new ElectricEngine(168); var myElectricMotorBike = new MotorBike(myElectricEngine); // Electric-bike outputs: var thr3 = myElectricEngine.CurThrottle; Console.WriteLine($"My electric throttle when idling is: {thr3}"); thr3 = myElectricEngine.MaxThrottle; Console.WriteLine($"My electric throttle at full speed is: {thr3}"); myElectricMotorBike.RunAtHalfSpeed(); thr3 = myElectricEngine.CurThrottle; Console.WriteLine($"My electric throttle at half speed is: {thr3}"); Console.ReadLine(); }
public GearBox(DieselEngine de) { DieselEngine = de; Locomotive = de.Locomotive; }
private object OnDieselEngineToggle(DieselEngine engine, BasePlayer player) { return(Interface.Oxide.CallDeprecatedHook("OnDieselEngineToggle", "OnDieselEngineToggle(DieselEngine engine, BasePlayer player)", new DateTime(2022, 12, 31), player, engine)); }
public override DieselEngine VisitDieselEngine(DieselEngine engine) { VisitEngine(engine); return(engine); }
public virtual DieselEngine VisitDieselEngine(DieselEngine engine) => engine;
public void UseLocoGearBox(DieselEngine dieselEngine) { DieselEngine = dieselEngine; }
public DieselCar() { engine = new DieselEngine(); }
protected override void EngineOn() { DieselEngine.StartFuelPump(); DieselEngine.Run(); }