This commit is contained in:
2026-06-26 00:21:29 +07:00
parent 5d1af952b1
commit 4fa3fb2c15
16 changed files with 221 additions and 2011 deletions

View File

@@ -39,12 +39,12 @@ namespace Hallucinate.GameSetup.Maze
}
}
public IEnumerator GenerateStepByStep(MazeGrid grid, float interval)
public IEnumerator GenerateStepByStep(MazeGrid grid, int cellsPerFrame)
{
int x = InitialX;
int z = InitialZ;
grid.SetCell(x, z, MazeCellType.Corridor);
yield return new WaitForSeconds(interval);
yield return null;
List<MapLocation> walls = GetNeighbouringWalls(grid, x, z);
foreach(var w in walls) grid.SetCell(w.x, w.z, MazeCellType.Processing);
@@ -59,7 +59,12 @@ namespace Hallucinate.GameSetup.Maze
if (grid.CountSquareNeighbours(w.x, w.z, MazeCellType.Corridor) == TargetCorridorNeighbours)
{
grid.SetCell(w.x, w.z, MazeCellType.Corridor);
if (interval > 0) yield return new WaitForSeconds(interval);
MazeManager.cellsProcessedThisFrame++;
if (MazeManager.cellsProcessedThisFrame >= cellsPerFrame)
{
MazeManager.cellsProcessedThisFrame = 0;
yield return null;
}
foreach (var nw in GetNeighbouringWalls(grid, w.x, w.z))
{