Exemplo n.º 1
0
 public Car(string i_ModelName, string i_LicenceID, eCarColor ColorOfCar, eDoorsAmount AmountOfDoors, string i_WheelsManfacturer) :
     base(i_ModelName, i_LicenceID)
 {
     r_ColorOfCar    = ColorOfCar;
     r_AmountOfDoors = AmountOfDoors;
     createVehicleWheels(k_MaxAirPressureForCar, i_WheelsManfacturer, k_NumberOfWheels);
 }
Exemplo n.º 2
0
 public Car(
     string i_ModelName,
     string i_LicensePlate,
     float i_EnergyLeft,
     string i_ManufacturerName,
     eColor i_Color,
     eDoorsAmount i_DoorsNumber,
     float i_MaxEngineCapacity,
     float i_CurrentAirPressure,
     Engine i_Engine,
     Vehicle.eType i_VehicleType) : base(
         i_ModelName,
         i_LicensePlate,
         i_EnergyLeft,
         k_NumberOfWheels,
         k_WheelsMaxAirPressure,
         i_ManufacturerName,
         i_MaxEngineCapacity,
         i_CurrentAirPressure,
         i_Engine,
         i_VehicleType)
 {
     m_Color       = i_Color;
     m_DoorsNumber = i_DoorsNumber;
 }
Exemplo n.º 3
0
        public static Vehicle createVehicleFromType(eVehicleType i_VehicletoCreate, string i_ModelName, string i_LicenceID, object i_UniqueParameter1, object i_UniqueParameter2, string i_WheelsManfacturer, float i_AmountOfCurrentEnergyLeft)
        {
            Vehicle newVehicle = new Vehicle(i_ModelName, i_LicenceID);

            if ((i_VehicletoCreate == eVehicleType.FuelMotorBike) || (i_VehicletoCreate == eVehicleType.ElectricMotorBike))
            {
                eLicenceType licenceID      = (eLicenceType)i_UniqueParameter1;
                int          engineCapacity = (int)i_UniqueParameter2;
                if (i_VehicletoCreate == eVehicleType.FuelMotorBike)
                {
                    FuelMotorBike newFuelMotorBike = new FuelMotorBike(i_ModelName, i_LicenceID, licenceID, engineCapacity, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft);
                    newVehicle = newFuelMotorBike;
                    newVehicle = newVehicle as FuelMotorBike;
                }
                else
                {
                    ElectricMotorBike newElectricMotorBike = new ElectricMotorBike(i_ModelName, i_LicenceID, licenceID, engineCapacity, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft);
                    newVehicle = newElectricMotorBike;
                    newVehicle = newVehicle as ElectricMotorBike;
                }
            }
            else if ((i_VehicletoCreate == eVehicleType.FuelCar) || (i_VehicletoCreate == eVehicleType.ElectricCar))
            {
                eCarColor    carColor    = (eCarColor)i_UniqueParameter1;
                eDoorsAmount doorsAmount = (eDoorsAmount)i_UniqueParameter2;
                if (i_VehicletoCreate == eVehicleType.FuelCar)
                {
                    FuelCar newFuelCar = new FuelCar(i_ModelName, i_LicenceID, carColor, doorsAmount, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft);
                    newVehicle = newFuelCar;
                    newVehicle = newVehicle as FuelCar;
                }
                else
                {
                    ElectricCar newElectricCar = new ElectricCar(i_ModelName, i_LicenceID, carColor, doorsAmount, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft);
                    newVehicle = newElectricCar;
                    newVehicle = newVehicle as ElectricCar;
                }
            }
            else if (i_VehicletoCreate == eVehicleType.Truck)
            {
                bool  carryingToxic = (bool)i_UniqueParameter1;
                float loadVolume    = (float)i_UniqueParameter2;
                Truck newTruck      = new Truck(i_ModelName, i_LicenceID, carryingToxic, loadVolume, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft);
                newVehicle = newTruck;
                newVehicle = newVehicle as Truck;
            }
            else
            {
                throw new ArgumentException();
            }
            if (newVehicle == null)
            {
                throw new FormatException();
            }
            return(newVehicle);
        }
Exemplo n.º 4
0
        public ElectricCar(string i_ModelName, string i_LicensePlate, float i_EnergyLeft, eColor i_CarColor, eDoorsAmount i_AmountOfDoors)
            : base(i_ModelName, i_LicensePlate, i_EnergyLeft)
        {
            GasVehicle         = false;
            this.carColor      = i_CarColor;
            this.amountOfDoors = i_AmountOfDoors;
            Battery            = new Battery(2.1f);
            Battery.TimeLeft   = EnergyLeft * Battery.TimeCapacity;

            for (int i = 0; i < 4; i++)
            {
                Wheels.Add(new Wheel(32));
            }
        }
Exemplo n.º 5
0
        public Car(string i_ModelName, string i_LicensePlate, float i_EnergyLeft, eColor i_CarColor, eDoorsAmount i_AmountOfDoors)
            : base(i_ModelName, i_LicensePlate, i_EnergyLeft)
        {
            Dictionary <string, string> extraData = new Dictionary <string, string>();

            extraData.Add("Color", i_CarColor.ToString());
            extraData.Add("Number of doors", i_AmountOfDoors.ToString());
            ExtraTypeData         = extraData;
            GasTank               = new GasTank(eGasType.Octan96, 60);
            GasVehicle            = true;
            this.color            = i_CarColor;
            GasTank.CurrentAmount = EnergyLeft * GasTank.MaxCapacity;
            this.amountOfDoors    = i_AmountOfDoors;
            for (int i = 0; i < 4; i++)
            {
                Wheels.Add(new Wheel(32));
            }
        }
Exemplo n.º 6
0
 public FuelCar(
     string i_ModelName,
     string i_LicensePlate,
     float i_CurrentFuelAmount,
     string i_ManufacturerName,
     eColor i_Color,
     eDoorsAmount i_DoorsNumber,
     float i_CurrentAirPressure) : base(
         i_ModelName,
         i_LicensePlate,
         i_CurrentFuelAmount,
         i_ManufacturerName,
         i_Color,
         i_DoorsNumber,
         m_MaxFuelCapacity,
         i_CurrentAirPressure,
         new FuelEngine(m_MaxFuelCapacity, m_FuelType, i_CurrentFuelAmount),
         m_Type)
 {
     m_CurrentFuelAmount = i_CurrentFuelAmount;
 }
Exemplo n.º 7
0
 public ElectricCar(
     string i_ModelName,
     string i_LicensePlate,
     float i_BatteryTimeLeft,
     string i_ManufacturerName,
     eColor i_Color,
     eDoorsAmount i_DoorsNumber,
     float i_CurrentAirPressure) : base(
         i_ModelName,
         i_LicensePlate,
         i_BatteryTimeLeft,
         i_ManufacturerName,
         i_Color,
         i_DoorsNumber,
         m_MaxBatteryTime,
         i_CurrentAirPressure,
         new ElectricEngine(m_MaxBatteryTime, i_BatteryTimeLeft),
         m_Type)
 {
     m_BatteryTimeLeft = i_BatteryTimeLeft;
 }
Exemplo n.º 8
0
 public ElectricCar(string i_ModelName, string i_LicenceID, eCarColor ColorOfCar, eDoorsAmount AmountOfDoors, string i_WheelsManfacturer, float i_AmountOfCurrentBattryLeft) :
     base(i_ModelName, i_LicenceID, ColorOfCar, AmountOfDoors, i_WheelsManfacturer)
 {
     asssaignEnergySourceToElectric(ref EnergySourceByRef, i_AmountOfCurrentBattryLeft, k_MaxBatteryTime, EnergyType.Electric);
 }
Exemplo n.º 9
0
 public FuelCar(string i_ModelName, string i_LicenceID, eCarColor ColorOfCar, eDoorsAmount AmountOfDoors, string i_WheelsManfacturer, float i_AmountOfCurrentFuelInLitters) :
     base(i_ModelName, i_LicenceID, ColorOfCar, AmountOfDoors, i_WheelsManfacturer)
 {
     asssaignEnergySourceToFuel(ref EnergySourceByRef, k_FuelType, i_AmountOfCurrentFuelInLitters, k_MaxAmountOfFuelInLitters, EnergyType.Fuel);
 }
Exemplo n.º 10
0
 public override void UpdateVehicleData(List <string> i_DataList)
 {
     base.UpdateVehicleData(i_DataList);
     m_Color       = (eColor)int.Parse(i_DataList[4]);
     m_DoorsAmount = (eDoorsAmount)int.Parse(i_DataList[5]);
 }