public override void FulfillVehicleDetails(VehicleEntranceForm i_VehicleEntranceForm)
 {
     Model = i_VehicleEntranceForm.VehicleModel;
     m_TruckTrunkCooling = i_VehicleEntranceForm.IsTruckTrunkCool;
     m_TrunkCapacity     = i_VehicleEntranceForm.TruckTrunkCapacity;
     Engine = new GasolineEngine(k_TruckFuelType, i_VehicleEntranceForm.CurrentFuelAmount, k_TruckVolumeOfFuelTank);
     for (int i = 0; i < k_NumberOfWheelsInTruck; i++)
     {
         Wheel WheelToAdd = new Wheel(
             i_VehicleEntranceForm.WheelManufacturer,
             i_VehicleEntranceForm.WheelCurrentAirPressure,
             k_MaximumAirPressure);
         Wheels.Add(WheelToAdd);
     }
 }
 public void Fuel(string i_LicenseNumber, GasolineEngine.eFuelType i_fuelToAdd, float i_amountToAdd)
 {
     if (r_VehiclesInfo.ContainsKey(i_LicenseNumber))
     {
         GasolineEngine gasolineEngine = r_VehiclesInfo[i_LicenseNumber].Vehicle.Engine as GasolineEngine;
         if (gasolineEngine != null)
         {
             gasolineEngine.Fuel(i_amountToAdd, i_fuelToAdd);
         }
         else
         {
             throw new ArgumentException(k_NotLegalFuel);
         }
     }
     else
     {
         throw new ArgumentException(k_NoSuitableVehicleMassage);
     }
 }
예제 #3
0
        public override void FulfillVehicleDetails(VehicleEntranceForm i_VehicleEntranceForm)
        {
            Model            = i_VehicleEntranceForm.VehicleModel;
            m_LicenseType    = i_VehicleEntranceForm.MotorcycleLicenseType;
            m_EngineCapacity = i_VehicleEntranceForm.MotorcycleEngineCapacity;
            if (i_VehicleEntranceForm.VehicleType == VehicleFactory.eVehicleType.ElectricMotorcycle)
            {
                Engine = new ElectricEngine(i_VehicleEntranceForm.RemainingBatteryHours, k_MaximumBatteryLifeHours);
            }
            else
            {
                Engine = new GasolineEngine(k_MotorcycleFuelType, i_VehicleEntranceForm.CurrentFuelAmount, k_MotorcycleVolumeOfFuelTank);
            }

            for (int i = 0; i < k_NumberOfWheelsInMotorcycle; i++)
            {
                Wheel WheelToAdd = new Wheel(
                    i_VehicleEntranceForm.WheelManufacturer,
                    i_VehicleEntranceForm.WheelCurrentAirPressure,
                    k_MaximumAirPressure);
                Wheels.Add(WheelToAdd);
            }
        }