Ejemplo n.º 1
0
        public int TakeOneFromNormalGroup(DateTime currentTime)
        {
            var normalItem = FoodItemsGatheringInfo.FirstOrDefault(x => x.Item1 > currentTime.AddMinutes(-MinutesUntilSpoiled));

            if (normalItem != null)
            {
                normalItem.Item2--;

                if (normalItem.Item2 <= 0)
                {
                    FoodItemsGatheringInfo.Remove(normalItem);
                }

                return(GetCountNormal(currentTime));
            }

            return(-1);
        }
Ejemplo n.º 2
0
        public int TakeOneFromSpoiledGroup(DateTime currentTime)
        {
            var spoiledItem = FoodItemsGatheringInfo.FirstOrDefault(x => x.Item1 <= currentTime.AddMinutes(-MinutesUntilSpoiled));

            if (spoiledItem != null)
            {
                spoiledItem.Item2--;

                if (spoiledItem.Item2 <= 0)
                {
                    FoodItemsGatheringInfo.Remove(spoiledItem);
                }

                return(GetCountSpoiled(currentTime));
            }

            return(-1);
        }