using UnityEngine; public static class Noise { public static float[,] GenerateNoiseMap(int mapWidth, int mapHeight, int seed, float scale, int octaves, float persistance, float lacunarity, Vector2 offset) { float[,] noiseMap = new float[mapWidth, mapHeight]; System.Random prng = new System.Random(seed); Vector2[] octaveOffsets = new Vector2[octaves]; for (int i=0; i maxNoiseHeight) { maxNoiseHeight = noiseHeight; } else if(noiseHeight < minNoiseHeight) { minNoiseHeight = noiseHeight; } noiseMap[y, x] = noiseHeight; } } for (int y = 0; y < mapHeight; y++) { for (int x = 0; x < mapWidth; x++) { noiseMap[x, y] = Mathf.InverseLerp(minNoiseHeight, maxNoiseHeight, noiseMap[x, y]); } } return noiseMap; } }