Beispiel #1
0
 internal void Refuel(float i_AmountToAdd, FuelType i_FuelType)
 {
     if (i_FuelType.Equals(m_FuelType))
     {
         AddEnergy(i_AmountToAdd);
     }
     else
     {
         throw new ArgumentException("The fuel you're trying to put isn't from the correct type.");
     }
 }
Beispiel #2
0
        public string EngineData(FuelType i_Energy)
        {
            string engineDescription;

            if (i_Energy.Equals(FuelType.Electricity))
            {
                engineDescription = string.Format(@"
            Current Battery Level : {0}
            Maximum Time For Battery(in hours) : {1}
            ", Engine.CurrentEnergyLevel, Engine.MaxEnergyLevel);
            }

            else
            {
                engineDescription = string.Format(@"
                Kind of fuel : {0}
                Gasoline level for now : {1}
                Maximum gasoline level : {2}
                ", Engine.EnergyType, Engine.CurrentEnergyLevel, Engine.MaxEnergyLevel);
            }

            return(engineDescription);
        }