using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace MazeGen
{
public enum RoomKind
{
Start,
Normal,
Hallway,
Exit
}
///
/// A single node in the maze graph. Rooms are NOT tied to a grid - Position is a free
/// world-space point derived from the exit direction + spacing of whichever exit spawned it.
///
public class Room
{
public readonly int Id;
public readonly RoomKind Kind;
public readonly Vector2 Position;
public readonly float Radius;
public readonly int DepthFromStart;
public readonly List Exits = new List();
///
/// Set only on Hallway rooms created as a 90-degree elbow connector between two
/// known doors (both straight extension and bend cases). World-space polyline the
/// corridor should be rendered along - [doorA, corner, doorB] for a bend, or left
/// null for hallway rooms whose far exit isn't resolved yet (ordinary lazy hallways).
///
public Vector2[] CorridorWaypoints;
public Room(int id, RoomKind kind, Vector2 position, float radius, int depthFromStart)
{
Id = id;
Kind = kind;
Position = position;
Radius = radius;
DepthFromStart = depthFromStart;
}
public IEnumerable UnusedExits => Exits.Where(e => !e.IsUsed);
public bool HasUnusedExits => Exits.Any(e => !e.IsUsed);
}
}