using UnityEngine;
namespace Hallucinate.GameSetup.Maze
{
///
/// A maze generation algorithm that "crawls" through the grid in a semi-random walk.
/// It creates long, winding corridors by moving vertically or horizontally.
///
public class Crawler : Maze
{
///
/// Orchestrates the crawling generation.
/// (Currently empty as per original procedural logic).
///
public override void Generate()
{
// Implementation can be expanded as needed.
}
///
/// Performs a vertical crawl starting from a random X position at the bottom.
///
protected void CrawlV()
{
bool done = false;
int x = Random.Range(1, width - 1);
int z = 1;
while (!done)
{
map[x, z] = Corridor;
if (Random.Range(0, 100) < 50)
{
x += Random.Range(-1, 2);
}
else
{
z += Random.Range(0, 2);
}
done |= (x < 1 || x >= width - 1 || z < 1 || z >= depth - 1);
}
}
///
/// Performs a horizontal crawl starting from a random Z position at the left.
///
protected void CrawlH()
{
bool done = false;
int x = 1;
int z = Random.Range(1, depth - 1);
while (!done)
{
map[x, z] = Corridor;
if (Random.Range(0, 100) < 50)
{
x += Random.Range(0, 2);
}
else
{
z += Random.Range(-1, 2);
}
done |= (x < 1 || x >= width - 1 || z < 1 || z >= depth - 1);
}
}
}
}