Skip to content
Snippets Groups Projects
Commit b30284e2 authored by Chang, Ryan's avatar Chang, Ryan
Browse files

Yeet

parent 1a63edcb
No related branches found
No related tags found
No related merge requests found
......@@ -24,8 +24,8 @@ public class BiomeGenerator : TerrainGenerator
[Header("Biome settings")]
[Tooltip("Larger values mean smaller biomes.")]
public float biomeGenerationFrequency = 1;
protected override void Start()
public override void Generate()
{
base.Start();
base.Generate();
}
}
......@@ -24,6 +24,8 @@ public class TerrainGenerator : MonoBehaviour
{
public Terrain terrain;
public Terrain[] terrains;
public List<Octave> octaves;
[Tooltip("The seed of the generation.")]
......@@ -36,15 +38,15 @@ public class TerrainGenerator : MonoBehaviour
[Tooltip("How fine grain the generated terrain will be. Larger values = more precise.")]
public int xSamples = 1000, ySamples = 1000;
protected virtual void Start()
public virtual void Generate()
{
float[,] heights = new float[xSamples, ySamples];
if (generateNewSeed)
{
crawlStartPosition = RNG.GetRandomVector2(-xSamples, -ySamples, xSamples, ySamples);
crawlStartPosition = RNG.GetRandomVector2(-xSamples, -ySamples, xSamples, ySamples);
}
foreach (var octave in octaves)
{
for (int x = 0; x < xSamples; x++)
......@@ -78,12 +80,18 @@ public class TerrainGenerator : MonoBehaviour
terrain.terrainData.SetHeights(0, 0, heights);
}
private void Start()
{
terrains = GetComponentsInChildren<Terrain>();
Generate();
}
private void Update()
{
if (refresh)
{
refresh = false;
Start();
Generate();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment