Beispiel #1
0
        public void ChargeVehicle(string vehicleID, float NumberOfMinutesToCharge)
        {
            PoweredByElectricity powerType = m_VehiclesInGarage[vehicleID].PowerType as PoweredByElectricity;

            if (powerType != null)
            {
                float NumOfhoursToCharge = NumberOfMinutesToCharge / 60;
                powerType.ChargeBattery(NumOfhoursToCharge);
            }
        }
Beispiel #2
0
        public Motorcycle(bool isElectricMotorcycle)
        {
            m_VehicleWheels = new List <Wheel>();

            for (int i = 0; i < k_NumOfWheelsInMotorcycle; i++)
            {
                Wheel wheelToAdd = new Wheel();
                wheelToAdd.MaximumAirPressure = k_MaxAirPressureInMotorcycleWheel;
                m_VehicleWheels.Add(wheelToAdd);
            }

            if (isElectricMotorcycle)
            {
                MotorcyclePowerType = new PoweredByElectricity(k_MaxBatteryCapacityInElectricMotorcycle);
            }
            else
            {
                MotorcyclePowerType = new PoweredByFuel(k_FuelPoweredMotorcycleeFuelType, k_MaxFuelTankCapacityInFuelPoweredMotorcycle);
            }
        }