コード例 #1
0
ファイル: CreateVehicle.cs プロジェクト: Jonasinbar/C-sharp-3
        /* public eVehicleType VehicleType
         * {
         *   get
         *   {
         *       return m_vehicleType;
         *   }
         *   set
         *   {
         *       m_vehicleType = value;
         *   }
         * }*/
        public static Vehicle CreateNewVehicle(eVehicleType i_VehicleType, VehicleInformation i_vehicleInformation, Dictionary <string, Object> i_specificInformation)
        {
            Vehicle newVehicle;

            switch (i_VehicleType)
            {
            case eVehicleType.ElectricCar:
                newVehicle = CreateElectricCar(i_vehicleInformation, i_specificInformation);
                break;

            case eVehicleType.ElectricMotorcycle:
                newVehicle = CreateElectricMotorcycle(i_vehicleInformation, i_specificInformation);
                break;

            case eVehicleType.FuelBasedCar:
                newVehicle = CreateFuelCar(i_vehicleInformation, i_specificInformation);
                break;

            case eVehicleType.FuelBasedMotorcycle:
                newVehicle = CreateFuelMotorcycle(i_vehicleInformation, i_specificInformation);
                break;

            case eVehicleType.FuelBasedTruck:
                newVehicle = CreateFuelTruck(i_vehicleInformation, i_specificInformation);
                break;

            default: throw new ArgumentException();
            }

            return(newVehicle);
        }
コード例 #2
0
ファイル: CreateVehicle.cs プロジェクト: Jonasinbar/C-sharp-3
        public static FuelBasedCar CreateFuelCar(VehicleInformation i_vehicleInformation, Dictionary <string, Object> i_specificInformation)
        {
            Car.eColor            color      = (Car.eColor)i_specificInformation["Color"];
            Car.eCarNumberOfDoors numOfDoors = (Car.eCarNumberOfDoors)i_specificInformation["Number Of Doors"];
            string       wheelManufacturer   = (string)i_specificInformation["Wheel Manufacturer"];
            FuelBasedCar fuelCar             = new FuelBasedCar(color, numOfDoors, i_vehicleInformation, wheelManufacturer);

            return(fuelCar);
        }
コード例 #3
0
ファイル: CreateVehicle.cs プロジェクト: Jonasinbar/C-sharp-3
        public static ElectricMotorcycle CreateElectricMotorcycle(VehicleInformation i_vehicleInformation, Dictionary <string, Object> i_specificInformation)
        {
            Motorcycle.eLicense license          = (Motorcycle.eLicense)i_specificInformation["License"];
            int                engineVolume      = (int)i_specificInformation["Engine Volume"];
            string             wheelManufacturer = (string)i_specificInformation["Wheel Manufacturer"];
            ElectricMotorcycle electricMoto      = new ElectricMotorcycle(license, engineVolume, i_vehicleInformation, wheelManufacturer);

            return(electricMoto);
        }
コード例 #4
0
ファイル: CreateVehicle.cs プロジェクト: Jonasinbar/C-sharp-3
        public static FuelBasedTruck CreateFuelTruck(VehicleInformation i_vehicleInformation, Dictionary <string, Object> i_specificInformation)
        {
            bool           isCooled          = (bool)i_specificInformation["Is Cooled"];
            float          cargoVolume       = (float)i_specificInformation["Cargo Volume"];
            string         wheelManufacturer = (string)i_specificInformation["Wheel Manufacturer"];
            FuelBasedTruck fuelTruck         = new FuelBasedTruck(isCooled, cargoVolume, i_vehicleInformation, wheelManufacturer);

            return(fuelTruck);
        }