Esempio n. 1
0
    public static BiomeMap GenerateBiomeMap(int width, int height, BiomeMapSettings settings, Vector2 sampleCenter, bool randomSeed = false)
    {
        NoiseSettings noiseSettings = settings.noiseSettings;

        if (randomSeed)
        {
            noiseSettings.seed = Random.Range(minSeedValue, maxSeedValue + 1);
        }

        float[,] noiseMap = NoiseGenerator.GeneratePerlinNoiseMap(width, height, noiseSettings, sampleCenter);

        BiomeMap biomeMap = new BiomeMap(noiseMap, settings.GetStartValues(), settings.biomes.Length);

        return(biomeMap);
    }
Esempio n. 2
0
    public void CreateNewBiomeMaps()
    {
        treeBiomeMap = MapGenerator.GenerateBiomeMap(clutterMapWidth, clutterMapWidth, currentTreeBiomeMapSettings, Vector2.zero, true);
        rockBiomeMap = MapGenerator.GenerateBiomeMap(clutterMapWidth, clutterMapWidth, currentRockBiomeMapSettings, Vector2.zero, true);

        treeBiomeMapPreviewImage.texture = TextureGenerator.TextureFromFloatArray2D(treeBiomeMap.values, currentTreeBiomeMapSettings.GetStartValues(), currentTreeBiomeMapSettings.GetColors());
        rockBiomeMapPreviewImage.texture = TextureGenerator.TextureFromFloatArray2D(rockBiomeMap.values, currentRockBiomeMapSettings.GetStartValues(), currentRockBiomeMapSettings.GetColors());

        treeBiomeMapSeed = currentTreeBiomeMapSettings.noiseSettings.seed;
        rockBiomeMapSeed = currentRockBiomeMapSettings.noiseSettings.seed;

        treeBiomeMapSeedText.text = treeBiomeMapSeed.ToString();
        rockBiomeMapSeedText.text = rockBiomeMapSeed.ToString();

        UpdateClutterMaps();
    }