コード例 #1
0
ファイル: Truck.cs プロジェクト: Crashiff/GarageManagerEx03
        public Truck(bool isElectric)
        {
            m_VehicleWheels = VehicleCreator.createWheels(k_NumberOfWheels, k_TruckMaxWheelPressure);
            m_VehicleEngine = VehicleCreator.CreateEngine(isElectric);

            PetrolEngine petrolEngine = m_VehicleEngine as PetrolEngine;

            petrolEngine.MaximumPetrolAmount = k_MaxPetrolLiterCapacity;
            petrolEngine.PetrolType          = k_PetrolType;
        }
コード例 #2
0
        public Car(bool isElectric)
        {
            m_VehicleWheels = VehicleCreator.createWheels(k_NumberOfWheels, k_CarMaxWheelPressure);

            m_VehicleEngine = VehicleCreator.CreateEngine(isElectric);
            if (isElectric)
            {
                ElectricEngine electricEngine = m_VehicleEngine as ElectricEngine;
                electricEngine.MaximumBatteryHours = k_MaxBatteryHoursCapacity;
            }
            else
            {
                PetrolEngine petrolEngine = m_VehicleEngine as PetrolEngine;
                petrolEngine.MaximumPetrolAmount = k_MaxPetrolLiterCapacity;
                petrolEngine.PetrolType          = k_PetrolType;
            }
        }