Esempio n. 1
0
 protected Vehicle(GeneralRequest i_CommonDetails)
 {
     m_Model          = i_CommonDetails.Model;
     m_LicencePlate   = i_CommonDetails.LicencePlate;
     m_EnergyRemained = i_CommonDetails.EnergyRemained;
     m_WheelSet       = i_CommonDetails.Wheels;
 }
Esempio n. 2
0
        public Vehicle CreateVehicle(GeneralRequest generalRequest, object vehicleRequest, bool IsElectric)
        {
            const float electricCarMaxEnergyLevel    = 4.8f;
            const float electricBikeMaxEnergyLevel   = 3.2f;
            const float liquidFuelBikeMaxEnergyLevel = 5f;
            const float liquidFuelCarMaxEnergyLevel  = 48f;
            const float truckMaxEnergyLevel          = 105f;

            float   remainadEnergy = generalRequest.EnergyRemained;
            Vehicle vehicle        = null;

            if (vehicleRequest.GetType().Name == "CarRequest")
            {
                if (IsElectric)
                {
                    vehicle = new ElectricCar(generalRequest, (CarRequest)vehicleRequest, CurrentEnergyLevel(electricCarMaxEnergyLevel, remainadEnergy), electricCarMaxEnergyLevel);
                }
                else
                {
                    vehicle = new LiquidFuelCar(generalRequest, (CarRequest)vehicleRequest, CurrentEnergyLevel(liquidFuelCarMaxEnergyLevel, remainadEnergy), liquidFuelCarMaxEnergyLevel);
                }
            }
            else if (vehicleRequest.GetType().Name == "BikeRequest")
            {
                if (IsElectric)
                {
                    vehicle = new ElectricBike(generalRequest, (BikeRequest)vehicleRequest, CurrentEnergyLevel(electricBikeMaxEnergyLevel, remainadEnergy), electricBikeMaxEnergyLevel);
                }
                else
                {
                    vehicle = new LiquidFuelBike(generalRequest, (BikeRequest)vehicleRequest, CurrentEnergyLevel(liquidFuelBikeMaxEnergyLevel, remainadEnergy), liquidFuelBikeMaxEnergyLevel);
                }
            }
            else if (vehicleRequest.GetType().Name == "TruckRequest")
            {
                vehicle = new Truck(generalRequest, (TruckRequest)vehicleRequest, CurrentEnergyLevel(truckMaxEnergyLevel, remainadEnergy), truckMaxEnergyLevel);
            }
            return(vehicle);
        }
Esempio n. 3
0
 protected Bike(GeneralRequest i_CommonDetails, BikeRequest i_BikeDetails) : base(i_CommonDetails)
 {
     LicenceCategory = i_BikeDetails.LicenceCategory;
 }
Esempio n. 4
0
 public LiquidFuelBike(GeneralRequest i_GeneralDetails, BikeRequest i_BikeData, float i_CurrentEnergyLevel, float i_MaxEnergyLevel)
     : base(i_GeneralDetails, i_BikeData)
 {
     Engine = new Engine(FuelType.Octan95, i_CurrentEnergyLevel, i_MaxEnergyLevel);
 }
Esempio n. 5
0
 public ElectricBike(GeneralRequest i_GeneralData, BikeRequest i_BikeData, float i_CurrentEnergyLevel, float i_MaxEnergyLevel)
     : base(i_GeneralData, i_BikeData)
 {
     Engine = new Engine(FuelType.Electricity, i_CurrentEnergyLevel, i_MaxEnergyLevel);
 }
Esempio n. 6
0
 public Truck(GeneralRequest i_CommonDetails, TruckRequest i_TruckDetails, float i_CurrentEnergyLevel, float i_MaxEnergyLevel) : base(i_CommonDetails)
 {
     TrunkVolume    = i_TruckDetails.TrunkVolume;
     TrunkIsChilled = i_TruckDetails.TrunkIsChilled;
     Engine         = new Engine(FuelType.Solar, i_CurrentEnergyLevel, i_MaxEnergyLevel);
 }
Esempio n. 7
0
 public LiquidFuelCar(GeneralRequest i_GeneralDetails, CarRequest i_CarDetails, float i_CurrentEnergyLevel, float i_MaxEnergyLevel)
     : base(i_GeneralDetails, i_CarDetails)
 {
     Engine = new Engine(FuelType.Octan96, i_CurrentEnergyLevel, i_MaxEnergyLevel);
 }
Esempio n. 8
0
 public ElectricCar(GeneralRequest i_GlobalRequest, CarRequest i_GenericCar, float i_EnergyRemined, float i_MaxEnergyLevel)
     : base(i_GlobalRequest, i_GenericCar)
 {
     Engine = new Engine(FuelType.Electricity, i_EnergyRemined, i_MaxEnergyLevel);
 }
Esempio n. 9
0
 protected Car(GeneralRequest i_CommonDetails, CarRequest i_CarDetails) : base(i_CommonDetails)
 {
     CarColor      = i_CarDetails.CarColor;
     NumberOfDoors = i_CarDetails.NumberOfDoors;
 }