Пример #1
0
        public CaveGenerator(int width, int height, String name, double fillPercentage, int smoothness, Quinoa quinoa)
        {
            header = new RegionHeader(name);
            region = new Region(width, height);
            header.setRegion(region);
            entrance = new RegionExit(width / 2, height / 2, 0, 0, "", ExitDecorator.UP_STAIR);
            exit = new RegionExit(width / 2, (height / 2) + 1, 0, 0, "", ExitDecorator.DOWN_STAIR);
            header.getExits().Add(entrance);
            header.getExits().Add(exit);
            region.setLightingModel(LightingModel.CAVE);
            this.quinoa = quinoa;
            this.fillPercentage = fillPercentage;
            this.smoothness = smoothness;

            chambers = new List<Chamber>();

            //fill with solid rock
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    region.setTerrain(x, y, new Terrain());
                    region.getTerrain(x, y).setCode(TerrainCode.ROCK);
                }
            }
        }
        public ForestGenerator(int width, int height, String name, double treeDensity, Quinoa quinoa)
        {
            header = new RegionHeader(name);
            region = new Region(width, height);
            header.setRegion(region);
            region.setLightingModel(LightingModel.ABOVE_GROUND);
            this.quinoa = quinoa;
            this.treeDensity = treeDensity;

            //fill the forest with grass
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    region.setTerrain(x, y, new Terrain());
                    region.getTerrain(x, y).setCode(TerrainCode.GRASS);
                }
            }
        }