Introduced dialogue graph magic, created assest and importers. Added events for broadcasting puzzle steps

This commit is contained in:
2025-09-26 13:32:14 +02:00
committed by Michal Pikulski
parent 2cd791f69d
commit 0bb3ad10a0
23 changed files with 1258 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using PuzzleS;
using UnityEngine.SceneManagement;
using System; // added for Action<T>
/// <summary>
/// Manages puzzle step registration, dependency management, and step completion for the puzzle system.
@@ -32,6 +33,10 @@ public class PuzzleManager : MonoBehaviour
}
}
// Events to notify about step lifecycle
public event Action<PuzzleStepSO> StepCompleted;
public event Action<PuzzleStepSO> StepUnlocked;
private HashSet<PuzzleStepSO> completedSteps = new HashSet<PuzzleStepSO>();
private HashSet<PuzzleStepSO> unlockedSteps = new HashSet<PuzzleStepSO>();
@@ -122,6 +127,10 @@ public class PuzzleManager : MonoBehaviour
if (completedSteps.Contains(step)) return;
completedSteps.Add(step);
Debug.Log($"[Puzzles] Step completed: {step.stepId}");
// Broadcast completion
StepCompleted?.Invoke(step);
foreach (var unlock in step.unlocks)
{
if (AreRuntimeDependenciesMet(unlock))
@@ -165,6 +174,9 @@ public class PuzzleManager : MonoBehaviour
behaviour.UnlockStep();
}
Debug.Log($"[Puzzles] Step unlocked: {step.stepId}");
// Broadcast unlock
StepUnlocked?.Invoke(step);
}
/// <summary>