Example #1
0
        public void RemoveAllNormal(DateTime currentTime)
        {
            var copy = FoodItemsGatheringInfo.ToList();

            foreach (var x in copy)
            {
                if (x.Item1 > currentTime.AddMinutes(-MinutesUntilSpoiled))
                {
                    FoodItemsGatheringInfo.Remove(x);
                }
            }
        }
Example #2
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);
        }
Example #3
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);
        }