Esempio n. 1
0
        public static Vehicle CreateVehicle(eVehicleOption i_ChonsenVehicle, string i_LicenceNum, string i_Model)
        {
            Vehicle newVehicle = null;

            switch (i_ChonsenVehicle)
            {
            case eVehicleOption.FuelCar:
                newVehicle = new FuelCar(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.ElecticCar:
                newVehicle = new ElectricCar(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.FuelMotorcycle:
                newVehicle = new FuelMotorcycle(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.ElectricMotorcycle:
                newVehicle = new ElectricMotorcycle(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.FuelTrack:
                newVehicle = new FuelTrack(i_LicenceNum, i_Model);
                break;
            }

            return(newVehicle);
        }
Esempio n. 2
0
        public static void TrackPropertise(Vehicle i_Track, float i_TrunkCapacity, bool i_IsHaveCoolTrunk)
        {
            FuelTrack track = i_Track as FuelTrack;

            if (track != null)
            {
                track.HaveCoolTrunk = i_IsHaveCoolTrunk;
                track.TrunkCapacity = i_TrunkCapacity;
            }
            else
            {
                throw new Exception();   // to change
            }
        }