示例#1
0
        public void ActivateRandom(APIActivator activator = APIActivator.XANA)
        {
            List <Sector> randomSectors = Program.ShuffleList(Sectors.Cast <Sector>().ToList());

            Boolean found = false;

            foreach (Sector sector in randomSectors)
            {
                try {
                    if (!found)
                    {
                        sector.ActivateRandom(activator);
                        found = true;
                    }
                }
                catch (NoFreeTowersException) {
                    //continue
                }
            }

            if (!found)
            {
                throw new NoFreeSectorsException(this);
            }
        }