コード例 #1
0
 /// Driving on fuel
 public Motorcycle(eLicenseType i_eLicense, int i_EngineCapacityIncc, string i_ModelName, string i_LicenseNumber, float i_PercentageOfVehicleEnergy, float i_CurrentFuel, string i_WheelsManufacturerName, float i_WheelsCurrentAirPressure)
     : base(i_ModelName, i_LicenseNumber, i_PercentageOfVehicleEnergy)
 {
     this.m_eLicense         = i_eLicense;
     this.EngineCapacityIncc = i_EngineCapacityIncc;
     this.m_MaxFuelOrElectic = 8f;
     FuelVehicle.eFueltType eFueltType = FuelVehicle.eFueltType.Octan95;
     VehicleDrivingOnFuel = new FuelVehicle(i_CurrentFuel, m_MaxFuelOrElectic, eFueltType);
     Wheels  = new Wheel(i_WheelsManufacturerName, i_WheelsCurrentAirPressure, 33, 2);
     m_fuelt = ", fuelt type: " + eFueltType;
 }
コード例 #2
0
 //// Driving on fuel
 public Car(eVehicleColor i_eVehicleColor, string i_ModelName, string i_LicenseNumber, float i_PercentageOfVehicleEnergy, float i_CurrentFuel, string i_WheelsManufacturerName, float i_WheelsCurrentAirPressure)
     : base(i_ModelName, i_LicenseNumber, i_PercentageOfVehicleEnergy)
 {
     this.m_eColor           = i_eVehicleColor;
     this.m_eQuantityOfDoors = eQuantityOfDoors.Four;
     FuelVehicle.eFueltType eFueltType = FuelVehicle.eFueltType.Octan96;
     this.m_MaxFuelOrMaxTimeBattery = 55f;
     VehicleDrivingOnFuel           = new FuelVehicle(i_CurrentFuel, m_MaxFuelOrMaxTimeBattery, eFueltType);
     Wheels  = new Wheel(i_WheelsManufacturerName, i_WheelsCurrentAirPressure, 31, 4);
     m_fuelt = ", fuelt type: " + eFueltType;
 }
コード例 #3
0
 public Truck(bool i_IsDrivingDangerousMaterials, float i_VolumeOfCargo, string i_ModelName, string i_LicenseNumber, float i_PercentageOfVehicleEnergy, float i_CurrentFuel, string i_WheelsManufacturerName, float i_WheelsCurrentAirPressure)
     : base(i_ModelName, i_LicenseNumber, i_PercentageOfVehicleEnergy)
 {
     this.m_IsDrivingDangerousMaterials = i_IsDrivingDangerousMaterials;
     this.m_VolumeOfCargo = i_VolumeOfCargo;
     FuelVehicle.eFueltType eFueltType = FuelVehicle.eFueltType.Soler;
     m_MaxFuel            = 110f;
     VehicleDrivingOnFuel = new FuelVehicle(i_CurrentFuel, m_MaxFuel, eFueltType);
     Wheels  = new Wheel(i_WheelsManufacturerName, i_WheelsCurrentAirPressure, 26, 12);
     m_fuelt = ", fuelt type: " + eFueltType;
 }
 public void FindVehicleAndSendItToGasStation(string i_LicenseNumber, FuelVehicle.eFueltType i_eFueltType, float i_FuelToFill)
 {
     foreach (Vehicle vehicle in VehiclesInGarage)
     {
         if (vehicle.LicenseNumber == i_LicenseNumber)
         {
             if (vehicle.ElectricVehicle is ElectricVehicle)
             {
                 throw new ArgumentException("It is impossible to fuel an electric vehicle with fuel");
             }
             else if (vehicle.VehicleDrivingOnFuel.EFueltType == i_eFueltType)
             {
                 vehicle.VehicleDrivingOnFuel.FillFuel(i_FuelToFill);
             }
             else if (vehicle.VehicleDrivingOnFuel.EFueltType != i_eFueltType)
             {
                 throw new ArgumentException("Fuel type is not suitable for your vehicle type");
             }
         }
     }
 }