Ejemplo n.º 1
0
        /// <summary>
        /// Allows the microorganisms to consume pollutants in their Hexes.
        /// </summary>
        private void FeedingPhase()
        {
            Dictionary <Consumption, float> consumptionPerMicroorganism = Tick.GetEmptyConsumptionPerMicroorganism();

            foreach (PetriDishSlot petriDishSlot in hexMap.AllHexes)
            {
                if (petriDishSlot.Microorganism != null)
                {
                    float amountConsumed = Feed(petriDishSlot);

                    if (!(petriDishSlot.Microorganism is null) && !(petriDishSlot.Pollutant is null))
                    {
                        Consumption consumption = new Consumption(petriDishSlot.Microorganism, petriDishSlot.Pollutant);

                        consumptionPerMicroorganism[consumption] += amountConsumed;
                    }
                }
            }

            bool updateGraph = (TimeManager.NextTick % graphUpdateIntervalDays) == 0;

            TimeManager.CalculateNewTick(consumptionPerMicroorganism, updateGraph);
        }