MazeGenerationSettings.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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("Layout")]
  12. [Tooltip("World-space distance between a room's center and the next room it spawns.")]
  13. public float roomSpacing = 4f;
  14. public float startRoomRadius = 1.2f;
  15. public float normalRoomRadius = 1f;
  16. public float hallwayRadius = 0.5f;
  17. public float exitRoomRadius = 1.2f;
  18. [Header("Room kind mix")]
  19. [Range(0f, 1f)] public float hallwayChance = 0.25f;
  20. [Header("Room merging (loops)")]
  21. [Tooltip("Extra clearance (world units) required between a candidate hallway path and any unrelated room/hallway footprint for that path to be considered clear.")]
  22. public float hallwayClearance = 0.1f;
  23. [Header("Collision avoidance (repositioning)")]
  24. [Tooltip("Distance (world units) between successive rings when searching for a collision-free spot to move a newly spawned room to.")]
  25. public float repositionRingStep = 1f;
  26. [Tooltip("Number of candidate positions sampled per ring while searching for a collision-free spot.")]
  27. [Range(4, 36)] public int repositionSamplesPerRing = 12;
  28. [Tooltip("Maximum number of rings to search outward before giving up and using the original (possibly overlapping) position.")]
  29. [Range(1, 32)] public int maxRepositionRings = 10;
  30. [Header("Exit-room eligibility")]
  31. [Tooltip("Number of NEW (never-before-visited) rooms the agent must have entered before an Exit room is allowed to appear.")]
  32. public int minNewRoomsBeforeExitEligible = 5;
  33. [Range(0f, 1f)] public float exitRoomChanceOnceEligible = 0.2f;
  34. [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.")]
  35. public int forceExitAfterNewRooms = 20;
  36. }
  37. }