Files
BABA_YAGA/Assets/Scripts/GameSetup/Maze/MazeVisualProfile.cs

129 lines
3.7 KiB
C#
Raw Normal View History

2026-06-09 02:05:00 +07:00
using Sirenix.OdinInspector;
2026-04-21 23:28:49 +07:00
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
{
2026-06-08 23:25:33 +07:00
[CreateAssetMenu(fileName = "MazeVisualProfile", menuName = "BABA_YAGA/Maze/Visual Profile")]
2026-04-21 23:28:49 +07:00
public class MazeVisualProfile : ScriptableObject
{
2026-06-09 02:05:00 +07:00
[BoxGroup("Rotation Offsets")]
2026-05-01 20:50:08 +07:00
public float tJunctionOffset = 0f;
2026-06-09 02:05:00 +07:00
[BoxGroup("Rotation Offsets")]
2026-05-01 20:50:08 +07:00
public float cornerOffset = 0f;
2026-06-09 02:05:00 +07:00
[BoxGroup("Rotation Offsets")]
2026-05-01 20:50:08 +07:00
public float deadEndOffset = 0f;
2026-06-09 02:05:00 +07:00
[BoxGroup("Rotation Offsets")]
2026-05-08 13:01:04 +07:00
public float stairsOffset = 0f;
2026-05-01 20:50:08 +07:00
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
[Required]
2026-04-21 23:28:49 +07:00
public GameObject wallPrefab;
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
[Required]
2026-04-21 23:28:49 +07:00
public GameObject corridorPrefab;
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
2026-04-21 23:28:49 +07:00
public GameObject processingPrefab;
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
2026-04-21 23:28:49 +07:00
public GameObject pathPrefab;
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
2026-04-21 23:28:49 +07:00
public GameObject startPrefab;
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
2026-04-21 23:28:49 +07:00
public GameObject endPrefab;
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
[Required]
2026-05-06 01:47:40 +07:00
public GameObject stairUpPrefab;
2026-06-09 02:05:00 +07:00
[BoxGroup("Cell Prefabs")]
[Required]
2026-05-06 01:47:40 +07:00
public GameObject stairDownPrefab;
2026-05-01 02:48:43 +07:00
2026-06-09 02:05:00 +07:00
[BoxGroup("Corridor Pieces")]
[Required]
2026-05-01 02:48:43 +07:00
public GameObject corridorStraight;
2026-06-09 02:05:00 +07:00
[BoxGroup("Corridor Pieces")]
[Required]
2026-05-01 02:48:43 +07:00
public GameObject corridorCorner;
2026-06-09 02:05:00 +07:00
[BoxGroup("Corridor Pieces")]
[Required]
2026-05-01 02:48:43 +07:00
public GameObject corridorTJunction;
2026-06-09 02:05:00 +07:00
[BoxGroup("Corridor Pieces")]
[Required]
2026-05-01 02:48:43 +07:00
public GameObject corridorCross;
2026-06-09 02:05:00 +07:00
[BoxGroup("Corridor Pieces")]
[Required]
2026-05-01 02:48:43 +07:00
public GameObject corridorDeadEnd;
2026-04-21 23:28:49 +07:00
2026-06-09 02:05:00 +07:00
[BoxGroup("Visualization")]
[MinValue(0.001f)]
2026-05-08 13:01:04 +07:00
public float scale = 0.167f;
2026-06-09 02:05:00 +07:00
[BoxGroup("Visualization")]
[MinValue(0f)]
2026-04-21 23:28:49 +07:00
public float animationDuration = 0.25f;
2026-06-09 02:05:00 +07:00
[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;
}
}
2026-04-21 23:28:49 +07:00
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,
2026-05-08 09:50:34 +07:00
MazeCellType.StairsUp => stairUpPrefab,
MazeCellType.StairsDown => stairDownPrefab,
2026-04-21 23:28:49 +07:00
_ => null
};
}
2026-06-09 02:05:00 +07:00
[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);
}
2026-04-21 23:28:49 +07:00
}
}