This commit is contained in:
Michal Pikulski
2025-10-07 12:57:23 +02:00
48 changed files with 3062 additions and 254 deletions

View File

@@ -205,16 +205,36 @@ namespace PuzzleS
}
/// <summary>
/// Unlocks all initial steps (those with no dependencies).
/// Unlocks all initial steps (those with no dependencies) and any steps whose dependencies are already met.
/// </summary>
private void UnlockInitialSteps()
{
// First, unlock all steps with no dependencies (initial steps)
var initialSteps = PuzzleGraphUtility.FindInitialSteps(_runtimeDependencies);
foreach (var step in initialSteps)
{
Debug.Log($"[Puzzles] Initial step unlocked: {step.stepId}");
UnlockStep(step);
}
// Keep trying to unlock steps as long as we're making progress
bool madeProgress;
do
{
madeProgress = false;
// Check all steps that haven't been unlocked yet
foreach (var step in _runtimeDependencies.Keys.Where(s => !_unlockedSteps.Contains(s)))
{
// Check if all dependencies have been completed
if (AreRuntimeDependenciesMet(step))
{
Debug.Log($"[Puzzles] Chain step unlocked: {step.stepId}");
UnlockStep(step);
madeProgress = true;
}
}
} while (madeProgress);
}
/// <summary>