public static float GetMaxAir(VehicleCreator.eVehicleType i_VehicleType, VehicleCreator.ePowerType i_EnergyType) { float maxAir = 0; switch (i_VehicleType) { case VehicleCreator.eVehicleType.Car: maxAir = 32f; break; case VehicleCreator.eVehicleType.Motorcycle: maxAir = 28f; break; case VehicleCreator.eVehicleType.Truck: maxAir = 30f; break; } return(maxAir); }
public static float GetMaxPower(VehicleCreator.eVehicleType i_VehicleType, VehicleCreator.ePowerType i_EnergyType) { float maxPower = 0; switch (i_VehicleType) { case VehicleCreator.eVehicleType.Car: if (i_EnergyType == VehicleCreator.ePowerType.Gas) { maxPower = 50f; } else { maxPower = 1.6f; } break; case VehicleCreator.eVehicleType.Motorcycle: if (i_EnergyType == VehicleCreator.ePowerType.Gas) { maxPower = 5.5f; } else { maxPower = 4.8f; } break; case VehicleCreator.eVehicleType.Truck: maxPower = 105f; break; } return(maxPower); }
public static float GetAirPressure(VehicleCreator.eVehicleType i_VehicleType, VehicleCreator.ePowerType i_EnergyType) { bool askAgain = true; float maxAir = GetMaxAir(i_VehicleType, i_EnergyType); float inputInFloat = 0; while (askAgain == true) { Console.WriteLine("Please enter current air pressure"); string inputFromUser = Console.ReadLine(); if (float.TryParse(inputFromUser, out inputInFloat)) { if (inputInFloat <= maxAir) { askAgain = false; } else { Console.WriteLine("The value you entered is too big please try again"); } } else { Console.WriteLine("Wrong input please try again"); } } return(inputInFloat); }
public static float GetAmountOfPowerSource(VehicleCreator.eVehicleType i_VehicleType, VehicleCreator.ePowerType i_EnergyType) { bool askAgain = true; float maxPower = GetMaxPower(i_VehicleType, i_EnergyType); float inputInFloat = 0; while (askAgain == true) { Console.WriteLine(@"How much power is your vehicle left? "); string inputFromUser = Console.ReadLine(); if (float.TryParse(inputFromUser, out inputInFloat)) { if (inputInFloat <= maxPower) { askAgain = false; } else { Console.WriteLine("The value you entered is too big please try again"); } } else { Console.WriteLine("Wrong input please try again"); } } return(inputInFloat); }