using UnityEngine; namespace MazeGen { [CreateAssetMenu(fileName = "MazeGenerationSettings", menuName = "MazeGen/Generation Settings")] public class MazeGenerationSettings : ScriptableObject { [Header("Exits per room")] [Tooltip("Exits are grid-locked to the 4 cardinal directions (N/E/S/W), so a room can have at most one exit per side.")] [Range(1, 4)] public int minExitsPerRoom = 1; [Range(1, 4)] public int maxExitsPerRoom = 4; [Header("Layout")] [Tooltip("World-space distance between a room's center and the next room it spawns.")] public float roomSpacing = 4f; public float startRoomRadius = 1.2f; public float normalRoomRadius = 1f; public float hallwayRadius = 0.5f; public float exitRoomRadius = 1.2f; [Header("Room kind mix")] [Range(0f, 1f)] public float hallwayChance = 0.25f; [Header("Room merging (loops)")] [Tooltip("Extra clearance (world units) required between a candidate hallway path and any unrelated room/hallway footprint for that path to be considered clear.")] public float hallwayClearance = 0.1f; [Header("Collision avoidance (repositioning)")] [Tooltip("Distance (world units) between successive rings when searching for a collision-free spot to move a newly spawned room to.")] public float repositionRingStep = 1f; [Tooltip("Number of candidate positions sampled per ring while searching for a collision-free spot.")] [Range(4, 36)] public int repositionSamplesPerRing = 12; [Tooltip("Maximum number of rings to search outward before giving up and using the original (possibly overlapping) position.")] [Range(1, 32)] public int maxRepositionRings = 10; [Header("Exit-room eligibility")] [Tooltip("Number of NEW (never-before-visited) rooms the agent must have entered before an Exit room is allowed to appear.")] public int minNewRoomsBeforeExitEligible = 5; [Range(0f, 1f)] public float exitRoomChanceOnceEligible = 0.2f; [Tooltip("Safety valve: if no Exit room has appeared naturally after this many new rooms, force the next generated room to be one, guaranteeing every maze is solvable in bounded steps.")] public int forceExitAfterNewRooms = 20; } }