private void CollectDeadBodies() { foreach (var fighter in Fighters.Values.Where(o => !o.IsAlive(configuration.CalculationValues))) { fighter.States.Clear(); // remove all pending states DeadFighters.Add(fighter.Id, fighter); CurrentRoundTick.Ticks.Add(new EngineFighterDiedTick() { Fighter = fighter.AsStruct() }); } foreach (var fighter in DeadFighters) { if (!Fighters.ContainsKey(fighter.Key)) { continue; } Fighters.Remove(fighter.Key); } }