Example #1
0
        /// <summary>
        /// Removes cars from a given line and attaches them to the locomotive
        /// </summary>
        /// <param name="line">The line that cars will be loaded from</param>
        /// <param name="amount">The amount of cars to load</param>
        public void LoadCarsFromLine(IDecrementableLine line, int amount)
        {
            // Do not load more cars than the locomotive's maximum capacity
            amount = amount > MaximumCapacity ? MaximumCapacity : amount;

            while (amount-- > 0)
            {
                var car = line.RemoveCar();
                Slots.Add(car);
            }
        }
Example #2
0
        /// <summary>
        /// Removes cars from a given line and attaches them to the locomotive
        /// </summary>
        /// <param name="line">The line that cars will be loaded from</param>
        /// <param name="amount">The amount of cars to load</param>
        public void LoadCarsFromLine(IDecrementableLine line, int amount)
        {
            // Do not load more cars than the locomotive's maximum capacity
            amount = amount > MaximumCapacity ? MaximumCapacity : amount;

            while (amount-- > 0)
            {
                var car = line.RemoveCar();
                Slots.Add(car);
            }
        }