StellarXipher/Assets/Puzzles/Simon Says Puzzle/Scripts/SimonSaysGameManager.cs
EthanPisani 7018c0b3eb
All checks were successful
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Successful in 4m50s
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Successful in 4m48s
Build project / Publish to itch.io (StandaloneLinux64) (push) Successful in 5s
Build project / Publish to itch.io (StandaloneWindows64) (push) Successful in 5s
balanced level1 door puzzles
2025-03-25 14:35:19 -04:00

76 lines
1.9 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public enum SGameState
{
Uninitialized,
Playing,
Win,
Lose
}
public class SimonSaysGameManager : MonoBehaviour
{
public int currentPuzzle = 1;
public SimonSaysPuzzle[] shapePuzzles = null;
public Button startPuzzleButton;
public SGameState gameState = SGameState.Uninitialized;
private void Start()
{
startPuzzleButton.onClick.AddListener(ButtonClicked);
}
public void StartGame() {
for (int i = 0; i < shapePuzzles.Length; i++)
{
SimonSaysPuzzle puzzle = shapePuzzles[i];
if (i == currentPuzzle)
{
puzzle.gameObject.SetActive(true);
continue;
}
puzzle.gameObject.SetActive(false);
}
}
private void ButtonClicked()
{
if (currentPuzzle > shapePuzzles.Length) {
Debug.Log("No more puzzles! " + currentPuzzle + " " + shapePuzzles.Length);
return;
}
shapePuzzles[currentPuzzle].StartPuzzle();
gameState = SGameState.Playing;
shapePuzzles[currentPuzzle].completeScreen.SetActive(false);
shapePuzzles[currentPuzzle].failedScreen.SetActive(false);
}
public void PuzzleCompleted()
{
shapePuzzles[currentPuzzle].gameObject.SetActive(false);
gameState = SGameState.Win;
// currentPuzzle++;
// if (currentPuzzle < shapePuzzles.Length)
// {
// shapePuzzles[currentPuzzle].gameObject.SetActive(true);
// startPuzzleButton.gameObject.SetActive(true);
// print("Puzzle advanced!");
// }
// else
// {
// print("No more puzzles!");
// }
}
}