Exemple #1
0
        public static Sector Get(Sectors sectors, int sX, int sY)
        {
            var gotSectors = sectors.Where(s => s.X == sX && s.Y == sY).ToList();

            if (!gotSectors.Any())
            {
                throw new GameConfigException("Sector not found:  X: " + sX + " Y: " + sY + " Total Sectors: " + sectors.Count());
            }

            if (gotSectors.Count() > 1)
            {
                throw new GameConfigException("Multiple sectors found. X: " + sX + " Y: " + sY + " Total Sectors: " + sectors.Count());
            }

            //There can only be one active sector
            return(gotSectors.Single());
        }
Exemple #2
0
 public int GetStarCount()
 {
     return(Sectors.Count(sector => sector.Item == SectorItem.Star));
 }