puzzle_games/Assets/Shape Puzzle/Scripts/ShapePuzzleManager.cs
2025-03-23 19:58:16 -04:00

43 lines
928 B
C#

using UnityEngine;
public class ShapePuzzleManager : MonoBehaviour
{
public int currentPuzzle = 1;
public ShapePuzzle[] shapePuzzles = null;
private void Start()
{
for (int i = 0; i < shapePuzzles.Length; i++)
{
ShapePuzzle puzzle = shapePuzzles[i];
puzzle.manager = this;
if (i == currentPuzzle)
{
puzzle.gameObject.SetActive(true);
continue;
}
puzzle.gameObject.SetActive(false);
}
}
public void PuzzleCompleted()
{
shapePuzzles[currentPuzzle].gameObject.SetActive(false);
currentPuzzle++;
if (currentPuzzle < shapePuzzles.Length)
{
shapePuzzles[currentPuzzle].gameObject.SetActive(true);
print("Puzzle advanced!");
}
else
{
print("No more puzzles!");
}
}
}