public void Clear() { if (UnitGroups == null) { UnitGroups = new HashSet <UnitListObject>(); } else { UnitGroups.Clear(); } }
public UnitGroup GetUnitGroup(string name) { if (UnitGroups == null) { throw new InvalidOperationException("The data must be loaded before getting a unit group."); } if (name == null) { throw new ArgumentNullException(nameof(name)); } return(UnitGroups.ContainsKey(name) ? UnitGroups[name] : UnitGroup.Unknown); }
public Unit SelectNextUnitGroup() { var ret = UnitGroups .Where(p => !p.HasMoved) .Where(p => p.IsAnyAlive) .Where(p => p.IsBattle) .OrderBy(p => p.Weight) .FirstOrDefault(); if (ret != null) { ret.HasMoved = true; } return(ret); }
private Unit GetUnit(string unitGroupId, string unitId) { var unitGroup = UnitGroups .FirstOrDefault(ug => ug.GroupIdentifier == unitGroupId); if (unitGroup == null) { throw new ExpectedException($"'{unitGroupId}' is not a known unit group."); } var unit = unitGroup .Units .FirstOrDefault(u => u.UnitIdentifier == unitId); if (unit == null) { throw new ExpectedException($"'{unitId}' is not part of the '{unitGroup.GroupIdentifier}' unit group."); } return(unit); }
public void Clear() { ClearRename(); if (UnitGroups == null) { UnitGroups = new HashSet <UnitListObject>(); } else { foreach (UnitListObject ulo in UnitGroups) { if (ulo != null) { Destroy(ulo.gameObject); } } UnitGroups.Clear(); } SelectedGroups.Clear(); }
public static UnitGroup GetUnitGroup(this UnitGroups source, string id) { return(source.FirstOrDefault(l => l.Id == id)); }
public void ResetArmor() { UnitGroups.ForEach(p => p.ResetArmor()); }
public void ResetMoved() { UnitGroups.ForEach(p => p.ResetMoved()); }
public string InfectionUnitAmount() { return(UnitGroups.Where(c => !c.GameOver() && c.UnitType == UnitType.Infection).Sum(c => c.AmountUnits()).ToString()); }
public string ImmuneUnitsAmount() { return(UnitGroups.Where(c => !c.GameOver() && c.UnitType == UnitType.Immune_System).Sum(c => c.AmountUnits()).ToString()); }
public string Part1() { return(UnitGroups.Sum(c => c.AmountUnits()).ToString()); }