MazeGenerationSettings.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using UnityEngine;
  2. namespace MazeGen
  3. {
  4. [CreateAssetMenu(fileName = "MazeGenerationSettings", menuName = "MazeGen/Generation Settings")]
  5. public class MazeGenerationSettings : ScriptableObject
  6. {
  7. [Header("Exits per room")]
  8. [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.")]
  9. [Range(1, 4)] public int minExitsPerRoom = 1;
  10. [Range(1, 4)] public int maxExitsPerRoom = 4;
  11. [Header("Start locations")]
  12. [Tooltip("Number of separate start rooms generated at level start. Spawning agents are distributed across these.")]
  13. [Range(1, 16)] public int startRoomCount = 1;
  14. [Tooltip("World-space radius of the disk start rooms are randomly scattered within. Ignored when startRoomCount is 1 (that one spawns at the origin).")]
  15. public float startRoomSpread = 6f;
  16. [Header("Layout")]
  17. [Tooltip("World-space distance between a room's center and the next room it spawns.")]
  18. public float roomSpacing = 4f;
  19. public float startRoomRadius = 1.2f;
  20. public float normalRoomRadius = 1f;
  21. public float hallwayRadius = 0.5f;
  22. public float exitRoomRadius = 1.2f;
  23. [Header("Room kind mix")]
  24. [Range(0f, 1f)] public float hallwayChance = 0.25f;
  25. [Header("Room merging (loops)")]
  26. [Tooltip("Extra clearance (world units) required between a candidate hallway path and any unrelated room/hallway footprint for that path to be considered clear.")]
  27. public float hallwayClearance = 0.1f;
  28. [Header("Collision avoidance (routing)")]
  29. [Tooltip("Distance (world units) between successive positions when searching for collision-free paths around obstacles.")]
  30. public float repositionRingStep = 1f;
  31. [Tooltip("Maximum number of search steps in each direction (straight extension and elbow bends) before declaring a spot truly unreachable. Widened from the old maxRepositionRings (was 10), since it's now the sole fallback for all obstruction routing.")]
  32. [Range(1, 200)] public int maxRouteSearchSteps = 40;
  33. [Header("Exit-room eligibility")]
  34. [Tooltip("Number of NEW (never-before-visited) rooms the agent must have entered before an Exit room is allowed to appear.")]
  35. public int minNewRoomsBeforeExitEligible = 5;
  36. [Range(0f, 1f)] public float exitRoomChanceOnceEligible = 0.2f;
  37. [Tooltip("Safety valve: if no Exit room has appeared naturally in the current branch after this many new rooms, force the next generated room in it to be one, guaranteeing every maze branch is solvable in bounded steps.")]
  38. public int forceExitAfterNewRooms = 20;
  39. [Tooltip("Maximum number of Exit rooms allowed to exist in the whole maze (0 = unlimited). Once reached, branches that still need an exit can no longer mint their own and must instead find/grow into one of the existing ones via loop-closing door connections - this is what pushes separate maze branches to join up instead of each getting their own exit.")]
  40. public int maxExitRooms = 0;
  41. }
  42. }