コード例 #1
0
        static TerrainData CreateTerrain(IntSize3 size)
        {
            //var random = Helpers.Random;
            var random = new Random(1);

            var terrain = new TerrainData(size);

            var tg = new TerrainGenerator(terrain, random);

            var corners = new DiamondSquare.CornerData()
            {
                NE = 15,
                NW = 10,
                SW = 10,
                SE = 10,
            };

            tg.Generate(corners, 5, 0.75, 2);

            int grassLimit = terrain.Depth * 4 / 5;

            TerrainHelpers.CreateVegetation(terrain, random, grassLimit);

            return(terrain);
        }
コード例 #2
0
        void CreateTerrain(IntSize3 size)
        {
            var random = Helpers.Random;

            var terrain = new TerrainData(size);

            var tg = new DungeonTerrainGenerator(terrain, random);

            tg.Generate(1);

            TerrainHelpers.CreateSoil(terrain, 9999);
            TerrainHelpers.CreateVegetation(terrain, random, 9999);

            m_rooms       = tg.Rooms;
            m_terrainData = terrain;
        }