Represents a region on the world map
示例#1
0
 /// <summary>
 /// Returns true if this region is adjacent to this region. That is they have at least one pair of adjacent tiles
 /// </summary>
 /// <param name="region"></param>
 /// <returns></returns>
 public bool IsNeighbour(Region region)
 {
     return region.Blocks.Any(b => IsNeighbour(b));
 }
        /// <summary>
        /// Initialises the World Map in preperation. Creates the regions with empty ones, and sets the default tile settings
        /// </summary>
        private static void Initialisation()
        {
            //start the map
            GameState.GlobalMap = new GlobalMap(WORLDSIZE);

            regions = new Region[REGIONSIZE + 1];

            //fill the regions with new regions

            for (int i = 0; i < regions.Length; i++)
            {
                regions[i] = new Region();
            }

            //populate the world map with a number of tiles with an elevation of 40

            for (int x = 0; x < WORLDSIZE; x++)
            {
                lock (GlobalMap.lockMe)
                { //this is rather inefficient, but it will allow the interface to draw something
                    //CurrentStep = "Populating Tiles for line :" + x;

                    for (int y = 0; y < WORLDSIZE; y++)
                    {
                        MapBlock block = new MapBlock();
                        block.Tile = new GlobalTile();
                        block.Tile.Coordinate = new MapCoordinate(x, y, 0, MapType.GLOBAL);

                        GlobalTile gTile = (block.Tile as GlobalTile);
                        gTile.Elevation = 40;
                        gTile.ClimateTemperature = 0;
                        gTile.HasHillSlope = false;
                        gTile.HasRiver = false;
                        gTile.Rainfall = 0;

                        GameState.GlobalMap.AddToGlobalMap(block);
                    }
                }
            }
        }