public override void ClaimUnits(ConcurrentDictionary <ulong, UnitCommander> commanders) { var hatcheryCount = UnitCountService.EquivalentTypeCompleted(UnitTypes.ZERG_HATCHERY); if (UnitCommanders.Count() >= hatcheryCount) { while (UnitCommanders.Count() > hatcheryCount) { UnitCommanders.Last().Claimed = false; UnitCommanders.Remove(UnitCommanders.Last()); } return; } foreach (var commander in commanders) { if (UnitCommanders.Count() < hatcheryCount) { if (!commander.Value.Claimed && commander.Value.UnitCalculation.Unit.UnitType == (uint)UnitTypes.ZERG_QUEEN) { commander.Value.Claimed = true; UnitCommanders.Add(commander.Value); } } } }