using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class BiomeMaster : MonoBehaviour { public List<BiomeParameter> parameters; [Header("Debug")] public bool updateDebug; public int debugSize = 500; public float debugFrequency = 0.1f; #region On Validate private void OnValidate() { if (updateDebug) { updateDebug = false; for (int i = -debugSize; i < debugSize; i++) { for (int j = -debugSize; j < debugSize; j++) { float x = i * debugFrequency; float y = j * debugFrequency; float h = 0; Color colorBlend = new(); foreach (var parameter in parameters) { foreach (var octave in parameter.map) { float strength = octave.Calculate(new(x, y)); h += strength; if (octave.amplitude > 0) colorBlend += parameter.debugColor * (strength / octave.amplitude) / parameters.Count; } } colorBlend.a = 1; Vector3 start = new(x, 0, y); Vector3 end = new(x, h, y); Debug.DrawLine(start, end, colorBlend, 10); } } } } #endregion }