using Sirenix.OdinInspector; using UnityEngine; namespace Hallucinate.GameSetup.Maze { [CreateAssetMenu(fileName = "MazeVisualProfile", menuName = "BABA_YAGA/Maze/Visual Profile")] public class MazeVisualProfile : ScriptableObject { [BoxGroup("Rotation Offsets")] public float tJunctionOffset = 0f; [BoxGroup("Rotation Offsets")] public float cornerOffset = 0f; [BoxGroup("Rotation Offsets")] public float deadEndOffset = 0f; [BoxGroup("Rotation Offsets")] public float stairsOffset = 0f; [BoxGroup("Cell Prefabs")] [Required] public GameObject wallPrefab; [BoxGroup("Cell Prefabs")] [Required] public GameObject corridorPrefab; [BoxGroup("Cell Prefabs")] public GameObject processingPrefab; [BoxGroup("Cell Prefabs")] public GameObject pathPrefab; [BoxGroup("Cell Prefabs")] public GameObject startPrefab; [BoxGroup("Cell Prefabs")] public GameObject endPrefab; [BoxGroup("Cell Prefabs")] [Required] public GameObject stairUpPrefab; [BoxGroup("Cell Prefabs")] [Required] public GameObject stairDownPrefab; [BoxGroup("Corridor Pieces")] [Required] public GameObject corridorStraight; [BoxGroup("Corridor Pieces")] [Required] public GameObject corridorCorner; [BoxGroup("Corridor Pieces")] [Required] public GameObject corridorTJunction; [BoxGroup("Corridor Pieces")] [Required] public GameObject corridorCross; [BoxGroup("Corridor Pieces")] [Required] public GameObject corridorDeadEnd; [BoxGroup("Room Pieces (Phase 2)")] public GameObject roomFloorPrefab; [BoxGroup("Room Pieces (Phase 2)")] public GameObject roomWallPrefab; [BoxGroup("Room Pieces (Phase 2)")] public GameObject roomCeilingPrefab; [BoxGroup("Room Pieces (Phase 2)")] public GameObject roomDoorwayPrefab; [BoxGroup("Visualization")] [MinValue(0.001f)] public float scale = 0.167f; [BoxGroup("Visualization")] [MinValue(1f)] [InfoBox("The physical distance between each grid cell. Default is 6 based on 3x3 intersections and 3x2 halls.")] public float nodeSpacing = 6f; [BoxGroup("Visualization")] [InfoBox("How far to push dead-end caps from the center so they touch the hallway edge. Default is 1.0.")] public float deadEndShift = 1.0f; [BoxGroup("Visualization")] [MinValue(0f)] public float animationDuration = 0.25f; [ShowInInspector] [ReadOnly] [BoxGroup("Validation")] private int MissingRequiredPrefabCount { get { var count = 0; if (wallPrefab == null) count++; if (corridorPrefab == null) count++; if (stairUpPrefab == null) count++; if (stairDownPrefab == null) count++; if (corridorStraight == null) count++; if (corridorCorner == null) count++; if (corridorTJunction == null) count++; if (corridorCross == null) count++; if (corridorDeadEnd == null) count++; return count; } } public GameObject GetPrefab(MazeCellType type) { return type switch { MazeCellType.Wall => wallPrefab, MazeCellType.Corridor => corridorPrefab, MazeCellType.Processing => processingPrefab, MazeCellType.Path => pathPrefab, MazeCellType.Start => startPrefab, MazeCellType.End => endPrefab, MazeCellType.StairsUp => stairUpPrefab, MazeCellType.StairsDown => stairDownPrefab, _ => null }; } [Button("Log Missing Required Prefabs")] private void LogMissingRequiredPrefabs() { if (MissingRequiredPrefabCount == 0) { Debug.Log($"{name}: all required maze prefabs are assigned.", this); return; } Debug.LogWarning($"{name}: {MissingRequiredPrefabCount} required maze prefab reference(s) are missing.", this); } } }