diff --git a/Assets/Scripts/GameSetup/Maze/MazeManager.cs b/Assets/Scripts/GameSetup/Maze/MazeManager.cs index 454e667d..7351907f 100644 --- a/Assets/Scripts/GameSetup/Maze/MazeManager.cs +++ b/Assets/Scripts/GameSetup/Maze/MazeManager.cs @@ -126,8 +126,8 @@ namespace Hallucinate.GameSetup.Maze } else { - _grid = new MazeGrid(width, depth); - mazeRenderer.Initialize(_grid, mazeContainer); + // _grid = new MazeGrid(width, depth); + // mazeRenderer.Initialize(_grid, mazeContainer); IMazeAlgorithm algorithm = GetAlgorithm(selectedAlgorithm); @@ -139,6 +139,8 @@ namespace Hallucinate.GameSetup.Maze { algorithm.Generate(_grid); } + _grid = new MazeGrid(width, depth); + mazeRenderer.Initialize(_grid, mazeContainer); } } private void ShuffleList(List list) diff --git a/Assets/Scripts/GameSetup/Maze/MazeRenderer.cs b/Assets/Scripts/GameSetup/Maze/MazeRenderer.cs index 509c36f6..c3994082 100644 --- a/Assets/Scripts/GameSetup/Maze/MazeRenderer.cs +++ b/Assets/Scripts/GameSetup/Maze/MazeRenderer.cs @@ -90,7 +90,7 @@ namespace Hallucinate.GameSetup.Maze if (_spawnedCells.TryGetValue(posKey, out GameObject oldObj)) { - Destroy(oldObj); + if (oldObj != null) DestroyImmediate(oldObj); _spawnedCells.Remove(posKey); } @@ -104,12 +104,17 @@ namespace Hallucinate.GameSetup.Maze else { prefab = visualProfile.GetPrefab(type); + + if (type == MazeCellType.StairsUp || type == MazeCellType.StairsDown) + { + rotation = Quaternion.Euler(0, visualProfile.stairsOffset, 0); + } } if (prefab == null) return; float safeScale = Mathf.Max(0.001f, visualProfile.scale); - float modelScaleMultiplier = 0.25f; + float modelScaleMultiplier = 1f; float yOffset = grid.Level * floorHeight; Vector3 localPos = new Vector3(x * safeScale, yOffset, z * safeScale); diff --git a/Assets/Scripts/GameSetup/Maze/MazeVisualProfile.cs b/Assets/Scripts/GameSetup/Maze/MazeVisualProfile.cs index d1e4784e..524ac73c 100644 --- a/Assets/Scripts/GameSetup/Maze/MazeVisualProfile.cs +++ b/Assets/Scripts/GameSetup/Maze/MazeVisualProfile.cs @@ -9,6 +9,7 @@ namespace Hallucinate.GameSetup.Maze public float tJunctionOffset = 0f; public float cornerOffset = 0f; public float deadEndOffset = 0f; + public float stairsOffset = 0f; [Header("Prefabs")] public GameObject wallPrefab; @@ -28,7 +29,7 @@ namespace Hallucinate.GameSetup.Maze public GameObject corridorDeadEnd; [Header("Visualization Settings")] - public float scale = 1f; + public float scale = 0.167f; public float animationDuration = 0.25f; public GameObject GetPrefab(MazeCellType type) diff --git a/Assets/Settings/Project Setting/DefaultMazeProfile.asset b/Assets/Settings/Project Setting/DefaultMazeProfile.asset index bcff1bf1..b5361602 100644 --- a/Assets/Settings/Project Setting/DefaultMazeProfile.asset +++ b/Assets/Settings/Project Setting/DefaultMazeProfile.asset @@ -15,6 +15,7 @@ MonoBehaviour: tJunctionOffset: 0 cornerOffset: 180 deadEndOffset: 0 + stairsOffset: 180 wallPrefab: {fileID: 865692088774546613, guid: c49f25c5b1c3e4b43a2bc56717387124, type: 3} corridorPrefab: {fileID: 919132149155446097, guid: 31c4154f4868c31419e8c1be5681fea1, type: 3} processingPrefab: {fileID: 1560533784803380970, guid: 1e8b6ed6b01405e4b9e358abc8f7a058, type: 3}