public void GenerateWaterMap(TilesMap map) { if (waterBiomes.Length > 0) { float firstThreshold = waterBiomes[0].WaterThresholding; float[,] waterDeepnessMap = noiseGenerator.Generate(waterNoiseMapParameters, map.Width, map.Height); List <WaterTile> waterTiles = GetAllWaterTiles(waterDeepnessMap, firstThreshold, out int deepEnoughTilesCount); SetWaterMap(map, waterTiles, deepEnoughTilesCount, firstThreshold); } }
public void GenerateBiomMap(TilesMap map) { float[,] heightNoiseArray = noiseGenerator.Generate(heightNoiseMapParameters, map.Width, map.Height); float[,] temperatureNoiseArray = noiseGenerator.Generate(temperatureNoiseMapParameters, map.Width, map.Height); temperatureLayerCountInversion = 1f / biomes.GetLength(1); heightLayerCountInversion = 1f / biomes.GetLength(0); FindMinMax(heightNoiseArray, out float heightMin, out float heightMax); FindMinMax(temperatureNoiseArray, out float temperatureMin, out float temperatureMax); for (int i = 0; i < map.Height; ++i) { for (int j = 0; j < map.Width; ++j) { Tile tile = map[i, j]; tile.Height = ScaleValue(heightNoiseArray[i, j], heightMin, heightMax, heightNoiseMapParameters); tile.Temperature = ScaleValue(temperatureNoiseArray[i, j], temperatureMin, temperatureMax, temperatureNoiseMapParameters); tile.Biom = CalculateBiom(tile.Temperature, tile.Height); } } }