예제 #1
0
 public CitySetNewTurn(CitySetBase parent)
     : base(parent)
 {
     for (int i = 0; i < parent.numberOfCities; ++i)
     {
         _cities.Add(new CityNewTurn(parent.GetCity(i)));
     }
 }
예제 #2
0
        /// <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);
        }
예제 #3
0
        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));
        }