예제 #1
0
        protected internal void EnergyFilling(float i_AmountOfEnergyToAdd, eEnergyType i_EnergyType, ref Vehicle io_Vehicle)
        {
            if ((i_AmountOfEnergyToAdd + m_RemainingEnergyAmount > m_MaximalEnergyAmount) || (i_AmountOfEnergyToAdd < 0))
            {
                throw new ValueOutOfRangeException("VehicleEnergy", 0.0f, m_MaximalEnergyAmount - m_RemainingEnergyAmount);
            }

            if (i_EnergyType != m_EnergyType)
            {
                throw new ArgumentException("Wrong Energy type at Fill()", "i_FuelType");
            }

            m_RemainingEnergyAmount += i_AmountOfEnergyToAdd;
            io_Vehicle.CalculateRemainingEnergyPercent();
        }