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

Some more comments

parent 8785b173
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,12 @@ public class TerrainGenThread
TerrainData = data;
}
/// <summary>
/// Gets the generated heights.
/// Throws InvalidOperationExcepion if the heights
/// aren't built yet.
/// </summary>
/// <returns></returns>
public float[,] GetHeights()
{
if (ready)
......
......@@ -51,7 +51,12 @@ public class TerrainGenerator : MonoBehaviour
private List<TerrainGenThread> generators = new();
private void ThreadGenerationFinished(TerrainGenThread genThread)
/// <summary>
/// Apply the terrain that was generated by genThread.
/// </summary>
/// <param name="genThread">The terrain gen thread that has finished
/// generating its terrain heights.</param>
private void ApplyGeneratedTerrain(TerrainGenThread genThread)
{
genThread.TerrainData.SetHeights(0, 0, genThread.GetHeights());
......@@ -96,6 +101,10 @@ public class TerrainGenerator : MonoBehaviour
StartCoroutine(CheckThreads());
}
/// <summary>
/// Wait until all threads are done.
/// </summary>
/// <returns></returns>
private IEnumerator CheckThreads()
{
yield return new WaitForEndOfFrame();
......@@ -121,7 +130,7 @@ public class TerrainGenerator : MonoBehaviour
{
if (genThread != null)
{
ThreadGenerationFinished(genThread);
ApplyGeneratedTerrain(genThread);
yield return new WaitForEndOfFrame();
}
}
......
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