FINALIZE THIS SHIEEEEEET

This commit is contained in:
Michal Pikulski
2025-10-16 19:40:11 +02:00
parent d2c6c5df38
commit e60cca7830
5 changed files with 145 additions and 30 deletions

View File

@@ -71,9 +71,16 @@ namespace PuzzleS
void Start()
{
// Register with PuzzleManager, regardless of enabled/disabled state
// PuzzleManager will call UnlockStep or LockStep based on current puzzle state
PuzzleManager.Instance?.RegisterStepBehaviour(this);
// Simply register with the PuzzleManager
// The manager will handle state updates appropriately based on whether data is loaded
if (stepData != null && PuzzleManager.Instance != null)
{
PuzzleManager.Instance.RegisterStepBehaviour(this);
}
else if (stepData == null)
{
Logging.Warning($"[Puzzles] Cannot register step on {gameObject.name}: stepData is null");
}
}
void OnDestroy()
@@ -83,7 +90,11 @@ namespace PuzzleS
_interactable.interactionStarted.RemoveListener(OnInteractionStarted);
_interactable.interactionComplete.RemoveListener(OnInteractionComplete);
}
PuzzleManager.Instance?.UnregisterStepBehaviour(this);
if (PuzzleManager.Instance != null && stepData != null)
{
PuzzleManager.Instance.UnregisterStepBehaviour(this);
}
}
/// <summary>