129 lines
3.7 KiB
C#
129 lines
3.7 KiB
C#
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("Visualization")]
|
|
[MinValue(0.001f)]
|
|
public float scale = 0.167f;
|
|
|
|
[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);
|
|
}
|
|
}
|
|
}
|