Update Puzzle Manager's initialization sequence
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PuzzleS;
|
using PuzzleS;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages puzzle step registration, dependency management, and step completion for the puzzle system.
|
/// Manages puzzle step registration, dependency management, and step completion for the puzzle system.
|
||||||
@@ -44,6 +45,18 @@ public class PuzzleManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
_instance = this;
|
_instance = this;
|
||||||
// DontDestroyOnLoad(gameObject);
|
// DontDestroyOnLoad(gameObject);
|
||||||
|
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||||
|
{
|
||||||
|
BuildRuntimeDependencies();
|
||||||
|
UnlockInitialSteps();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,12 +84,6 @@ public class PuzzleManager : MonoBehaviour
|
|||||||
Debug.Log($"[Puzzles] Unregistered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}");
|
Debug.Log($"[Puzzles] Unregistered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
BuildRuntimeDependencies();
|
|
||||||
UnlockInitialSteps();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Builds the runtime dependency graph for all registered steps.
|
/// Builds the runtime dependency graph for all registered steps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user