public CitySetNewTurn(CitySetBase parent) : base(parent) { for (int i = 0; i < parent.numberOfCities; ++i) { _cities.Add(new CityNewTurn(parent.GetCity(i))); } }
/// <summary> /// Fallback verification method. /// </summary> /// <param name="self"></param> /// <returns></returns> private static int CountActiveCities(this CitySetBase self) { int total = 0; for (int i = 0; i < self.numberOfCities; ++i) { if (self.GetCity(i).actionsRemaining > 0) { ++total; } } return(total); }
public static CityBase GetActiveCity(this CitySetBase self, int index, out int masterListIndex) { for (int i = 0, matchIndex = 0; i < self.numberOfCities; ++i) { var currentCity = self.GetCity(i); if (currentCity.actionsRemaining > 0) { if (matchIndex == index) { masterListIndex = i; return(currentCity); } ++matchIndex; } } throw new System.IndexOutOfRangeException(nameof(index)); }