[Puzzles][Input] Update input handling to not mistakingly miss frames. Add debug frame input debugging.

This commit is contained in:
Michal Pikulski
2025-09-03 16:55:21 +02:00
parent 93242b2702
commit 1dfcee3d2c
9 changed files with 196 additions and 26 deletions

View File

@@ -3,7 +3,25 @@ using System.Collections.Generic;
public class PuzzleManager : MonoBehaviour
{
public static PuzzleManager Instance { get; private set; }
private static PuzzleManager _instance;
public static PuzzleManager Instance
{
get
{
if (_instance == null)
{
_instance = FindAnyObjectByType<PuzzleManager>();
if (_instance == null)
{
var go = new GameObject("PuzzleManager");
_instance = go.AddComponent<PuzzleManager>();
DontDestroyOnLoad(go);
}
}
return _instance;
}
}
private HashSet<PuzzleStepSO> completedSteps = new HashSet<PuzzleStepSO>();
private HashSet<PuzzleStepSO> unlockedSteps = new HashSet<PuzzleStepSO>();
@@ -15,12 +33,12 @@ public class PuzzleManager : MonoBehaviour
void Awake()
{
if (Instance != null && Instance != this)
if (_instance != null && _instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
_instance = this;
DontDestroyOnLoad(gameObject);
}