Organize custom scripts and Shared under Assets/Scripts, and delete assembly definition files
This commit is contained in:
147
Assets/Scripts/Baba_yaga/GameSetup/Maze/MazeVisualProfile.cs
Normal file
147
Assets/Scripts/Baba_yaga/GameSetup/Maze/MazeVisualProfile.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Baba_yaga.GameSetup.Maze
|
||||
{
|
||||
[CreateAssetMenu(fileName = "MazeVisualProfile", menuName = "BABA_YAGA/Maze/Visual Profile")]
|
||||
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user