Example #1
0
 public CitySetCityChange(CitySetBase parent, int index, CityChange change)
     : base(parent)
 {
     _change     = change ?? throw new ArgumentNullException(nameof(change));
     _index      = index;
     _activeCity = _change.actionsRemaining > 0;
 }
Example #2
0
 public CitySetNewTurn(CitySetBase parent)
     : base(parent)
 {
     for (int i = 0; i < parent.numberOfCities; ++i)
     {
         _cities.Add(new CityNewTurn(parent.GetCity(i)));
     }
 }
Example #3
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);
        }
Example #4
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));
        }
 public CitySetNewCityChange(CitySetBase parent, CityBase newCity)
     : base(parent)
 {
     _newCity = newCity ?? throw new ArgumentNullException(nameof(newCity));
 }