コード例 #1
0
        public void RefuelVehicle(CustomerCard i_Cutomer, float i_Amount, string i_TypeStr)
        {
            eFuelType        eType      = FromStringToVehicleFuelTypeEnum(i_TypeStr);
            FuelEnergySource fuelSource = i_Cutomer.Vehicle.EnergySource as FuelEnergySource;

            if (fuelSource.FuelType == eType)
            {
                fuelSource.Load(i_Amount);
            }
            else
            {
                throw new ArgumentException("Fuel type is not suitable to this vehicle");
            }
        }
コード例 #2
0
        public void RefuelVehicle(CustomerCard i_Customer, float i_Amount, string i_TypeStr)
        {
            eFuelType fuelType;

            if (IsFuelType(i_TypeStr, out fuelType) == true)
            {
                FuelEnergySource fuelSource = i_Customer.Vehicle.EnergySource as FuelEnergySource;
                if (fuelSource.FuelType == fuelType)
                {
                    fuelSource.Load(i_Amount);
                    i_Customer.Vehicle.UpdateEnergyPercentageLeft();
                    if (r_ConnectedToDB == true)
                    {
                        addEnergyDBactions(i_Customer);
                    }
                }
                else
                {
                    throw new ArgumentException("Fuel type is not suitable to this vehicle");
                }
            }
        }