SadConsole.Effects.EffectsManager.UpdateEffects C# (CSharp) Method

UpdateEffects() public method

Updates all known effects and applies them to their associated cells.
public UpdateEffects ( double timeElapsed ) : void
timeElapsed double The time elapased since the last update.
return void
        public void UpdateEffects(double timeElapsed)
        {
            List<ICellEffect> effectsToRemove = new List<ICellEffect>();

            foreach (var effectData in _effects.Values)
            {
                List<Cell> cellsToRemove = new List<Cell>();
                effectData.Effect.Update(timeElapsed);

                foreach (var cell in effectData.Cells)
                {
                    effectData.Effect.Apply(cell);

                    if (effectData.Effect.IsFinished && effectData.Effect.RemoveOnFinished)
                        cellsToRemove.Add(cell);
                }

                foreach (var cell in cellsToRemove)
                {
                    effectData.Effect.Clear(cell);
                    effectData.Cells.Remove(cell);
                    _effectCells.Remove(cell);
                    cell.Effect = null;
                }

                if (effectData.Cells.Count == 0)
                    effectsToRemove.Add(effectData.Effect);
            }

            foreach (var effect in effectsToRemove)
                _effects.Remove(effect);
        }