Exemplo n.º 1
0
        // ------------ Methods to create unwalkable areas such as mountains and forests ------------\\



        /// <summary>
        /// Replaces walls with mountains/forests/unwalkables
        /// </summary>
        // TODO: Include mountains
        private void replaceWalls()
        {
            Mountain mountain = new Mountain();
            Grass    grass    = new Grass();

            // Trying mountains first:
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (map[x, y] == WALL)
                    {
                        if (Shapes.CanFitShapeOver(WALL, new Point(x, y), Shapes.GetShape(Shapes.TRIPLEx3_LEFT), map))
                        {
                            PlaceMountain(new Point(x, y), mountain.GetSpriteID(), GRASS2_SPRITEID, mountain.Shape);
                        }
                    }
                }
            }

            // Filling with forests where mountains do not fill.
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (map[x, y] == WALL)
                    {
                        FloodFillWall(new Point(x, y), FOREST_SPRITEID);
                    }
                }
            }
        }