CreateSoil() public static method

public static CreateSoil ( TerrainData data, int soilLimit ) : void
data TerrainData
soilLimit int
return void
        public static TerrainData CreateNoiseTerrain(IntSize3 size, Random random)
        {
            var terrain = new TerrainData(size);

            var noise    = CreateTerrainNoise();
            var noisemap = CreateTerrainNoiseMap(noise, new IntSize2(size.Width, size.Height));

            FillFromNoiseMap(terrain, noisemap);

            terrain.RescanLevelMap();

            double xk = (random.NextDouble() * 2 - 1) * 0.01;
            double yk = (random.NextDouble() * 2 - 1) * 0.01;

            TerrainHelpers.CreateBaseMinerals(terrain, random, xk, yk);

            TerrainHelpers.CreateOreVeins(terrain, random, xk, yk);

            TerrainHelpers.CreateOreClusters(terrain, random);

            RiverGen.Generate(terrain, random);

            int soilLimit = size.Depth * 4 / 5;

            TerrainHelpers.CreateSoil(terrain, soilLimit);

            int grassLimit = terrain.Depth * 4 / 5;

            TerrainHelpers.CreateVegetation(terrain, random, grassLimit);

            return(terrain);
        }
Example #2
0
        public void Generate(DiamondSquare.CornerData corners, double range, double h, double amplify)
        {
            GenerateHeightMap(corners, range, h, amplify);

            FillMap();

            var random  = m_random;
            var terrain = m_data;

            double xk = (random.NextDouble() * 2 - 1) * 0.01;
            double yk = (random.NextDouble() * 2 - 1) * 0.01;

            TerrainHelpers.CreateBaseMinerals(terrain, random, xk, yk);

            TerrainHelpers.CreateOreVeins(terrain, random, xk, yk);

            TerrainHelpers.CreateOreClusters(terrain, random);

            if (m_data.Width > 128)
            {
                var riverGen = new RiverGen(m_data, m_random);
                if (riverGen.CreateRiverPath())
                {
                    riverGen.AdjustRiver();
                }
                else
                {
                    Trace.TraceError("Failed to create river");
                }
            }

            int soilLimit = m_size.Depth * 4 / 5;

            TerrainHelpers.CreateSoil(m_data, soilLimit);
        }