IEnumerator RunLoop() { MeshGenerator meshGen = GetComponent <MeshGenerator>(); while (true) { cells.Update(Tick); meshGen.GenerateMesh(cells.Values(), 1); yield return(new WaitForSeconds(0.5f)); } }
void GenerateCave() { if (!useCustomSeed) { randomSeed = Time.time.ToString(); } rand = new System.Random(randomSeed.GetHashCode()); cells = new CellularSimulation <int>(width, height); cells.UpdateInPlace(InitialValue); for (int i = 0; i < smoothCount; i++) { cells.Update(Smooth); } MeshGenerator meshGen = GetComponent <MeshGenerator>(); meshGen.GenerateMesh(cells.Values(), 1); }