using System.Collections.Generic; using UnityEngine; using UnityEngine.AddressableAssets; namespace PuzzleS { /// /// Represents all puzzle steps in a level. /// This is automatically generated from folder structure during asset import. /// [CreateAssetMenu(fileName = "LevelPuzzleData", menuName = "AppleHills/Items & Puzzles/LevelPuzzleData")] public class PuzzleLevelDataSO : ScriptableObject { /// /// Unique identifier for this level, automatically set to match folder name /// public string levelId; /// /// Display name for this level /// public string displayName; /// /// All puzzle steps in this level /// public List allSteps = new List(); /// /// Steps that should be unlocked at level start (no dependencies) /// public List initialSteps = new List(); /// /// Pre-processed dependency data built at edit time. /// Maps step IDs to arrays of dependency step IDs (which steps are required by each step) /// public Dictionary stepDependencies = new Dictionary(); /// /// Check if all steps in the level are complete /// public bool IsLevelComplete(HashSet completedSteps) { if (completedSteps == null) return false; foreach (var step in allSteps) { if (step != null && !completedSteps.Contains(step)) { return false; } } return true; } /// /// Gets all steps that will be unlocked by completing the given step /// public List GetUnlockedSteps(PuzzleStepSO completedStep) { return completedStep != null ? completedStep.unlocks : new List(); } /// /// Check if this step is an initial step (no dependencies) /// public bool IsInitialStep(PuzzleStepSO step) { return step != null && initialSteps.Contains(step); } } }