Esempio n. 1
0
 public Car(
     string i_CarModel,
     string i_LicenseNumber,
     float i_EnergyPercent,
     List <Wheel> i_Wheels,
     PowerUsage i_PowerSource,
     eCarColor i_CarColor,
     eNumberOfDoors i_NumberOfDoors)
     : base(i_CarModel, i_LicenseNumber, i_EnergyPercent, i_Wheels, i_PowerSource)
 {
     m_CarColor      = i_CarColor;
     m_NumberOfDoors = i_NumberOfDoors;
 }
Esempio n. 2
0
 public MotorCycle(
     string i_CarModel,
     string i_LicenseNumber,
     float i_EnergyPercent,
     List <Wheel> i_Wheels,
     PowerUsage i_PowerSource,
     eLicenseType i_LicenseType,
     int i_EngineVolume)
     : base(i_CarModel, i_LicenseNumber, i_EnergyPercent, i_Wheels, i_PowerSource)
 {
     m_EngineVolume = i_EngineVolume;
     m_LicenseType  = i_LicenseType;
 }
Esempio n. 3
0
 public Vehicle(
     string i_CarModel,
     string i_LicenseNumber,
     float i_EnergyPercent,
     List <Wheel> i_Wheels,
     PowerUsage i_PowerSource)
 {
     m_CarModel      = i_CarModel;
     r_LicenseNumber = i_LicenseNumber;
     m_EnergyPercent = i_EnergyPercent;
     m_Wheels        = i_Wheels;
     m_PowerSource   = i_PowerSource;
 }
Esempio n. 4
0
 public Truck(
     string i_CarModel,
     string i_LicenseNumber,
     float i_EnergyPercent,
     List <Wheel> i_Wheels,
     PowerUsage i_PowerSource,
     bool i_DangerousMaterials,
     float i_CargoVolume)
     : base(i_CarModel, i_LicenseNumber, i_EnergyPercent, i_Wheels, i_PowerSource)
 {
     m_CargoVolume        = i_CargoVolume;
     m_DangerousMaterials = i_DangerousMaterials;
 }
Esempio n. 5
0
        public static PowerUsage CreatePowerSource(
            eVehicleType i_VehicleType,
            ePowerType i_EnergyType,
            float i_AmountOfPowerSource)
        {
            PowerUsage powerSource = null;

            switch (i_VehicleType)
            {
            case eVehicleType.Car:
                if (i_EnergyType == ePowerType.Gas)
                {
                    powerSource = new Gas(Gas.eGasType.Octan96, i_AmountOfPowerSource, 50f);
                }
                else
                {
                    powerSource = new Electricity(1.6f, i_AmountOfPowerSource);
                }

                break;

            case eVehicleType.Motorcycle:
                if (i_EnergyType == ePowerType.Gas)
                {
                    powerSource = new Gas(Gas.eGasType.Octan95, i_AmountOfPowerSource, 5.5f);
                }
                else
                {
                    powerSource = new Electricity(4.8f, i_AmountOfPowerSource);
                }

                break;

            case eVehicleType.Truck:
                powerSource = new Gas(Gas.eGasType.Soler, i_AmountOfPowerSource, 105f);
                break;
            }

            return(powerSource);
        }
Esempio n. 6
0
        public static Vehicle CreateVehicle(eVehicleType i_VehicleType, string i_Model, string i_LicenseNumber, PowerUsage i_Power, List <Wheel> i_Wheels, Dictionary <string, object> i_DynamicParameters)

        {
            Vehicle vehicleOfOwner = null;
            float   energyPercent  = i_Power.CurrentAmountOfPower / i_Power.MaxAmountOfPower * 100;

            switch (i_VehicleType)
            {
            case eVehicleType.Car:
                vehicleOfOwner = new Car(i_Model, i_LicenseNumber, energyPercent,
                                         i_Wheels,
                                         i_Power,
                                         (Car.eCarColor)Enum.GetValues(typeof(Car.eCarColor)).GetValue((int)i_DynamicParameters["Color"] - 1),
                                         (Car.eNumberOfDoors)Enum.GetValues(typeof(Car.eNumberOfDoors)).GetValue((int)i_DynamicParameters["Number of doors"] - 1));
                break;

            case eVehicleType.Motorcycle:
                vehicleOfOwner = new MotorCycle(i_Model, i_LicenseNumber, energyPercent,
                                                i_Wheels,
                                                i_Power,
                                                (MotorCycle.eLicenseType)Enum.GetValues(typeof(MotorCycle.eLicenseType)).GetValue((int)i_DynamicParameters["License type"] - 1),
                                                (int)i_DynamicParameters["Engine volume"]);
                break;

            case eVehicleType.Truck:
                vehicleOfOwner = new Truck(i_Model,
                                           i_LicenseNumber,
                                           energyPercent,
                                           i_Wheels,
                                           i_Power,
                                           (bool)i_DynamicParameters["Dangerous Materials"],
                                           (float)i_DynamicParameters["Cargo Volume"]);
                break;
            }

            return(vehicleOfOwner);
        }