public void TankeUpFuelVehicle(ref Vehicle i_Vehicle) { if (i_Vehicle != null) { if (i_Vehicle.EnergySystem is FuelSystem) { if (i_Vehicle.EnergySystem.MaximumEnergyStorage == i_Vehicle.EnergySystem.CurrentEnergyStorage) { Console.WriteLine("Fuel Tank is Full"); } else { ClientInteractions clientInteractions = new ClientInteractions(); float fuelAmount = clientInteractions.GetFuelAmountToAdd(i_Vehicle.EnergySystem.MaximumEnergyStorage - i_Vehicle.EnergySystem.CurrentEnergyStorage); FuelSystem.FuelType fuelType = FuelSystemUI.GetFuelTypeToAdd((i_Vehicle.EnergySystem as FuelSystem).VehicleFuelType); (i_Vehicle.EnergySystem as FuelSystem).SupplyEnergy(fuelAmount, fuelType); Console.WriteLine("Added {0} Liters To Tank successfully", fuelAmount); } } else { Console.WriteLine("Energy system Is Inappropriate"); } } else { Console.WriteLine("License Number Is Not Existing"); } }
public static EnergySystem GetNewEnergySystem(Vehicle.VehicleType i_VehicleType) { EnergySystem energySystem; if (i_VehicleType != Vehicle.VehicleType.Truck) { if (getEnergySystem() == EnergySystemType.Fuel) { energySystem = FuelSystemUI.GetFuelSystem(i_VehicleType); } else { energySystem = ElectricSystemUI.GetElectricSystem(i_VehicleType); } } else { energySystem = FuelSystemUI.GetFuelSystem(i_VehicleType); } return(energySystem); }