StellarXipher/Assets/Puzzles/Simon Says Puzzle/Scripts/SimonSaysGameManager.cs
EthanPisani e5e9a77b01
All checks were successful
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Successful in 15m19s
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Successful in 9m28s
Build project / Publish to itch.io (StandaloneLinux64) (push) Successful in 6s
Build project / Publish to itch.io (StandaloneWindows64) (push) Successful in 5s
added alpha version of word puzzle and simon says puzzle to tablet
2025-03-24 23:51:27 -04:00

71 lines
1.7 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()
{
for (int i = 0; i < shapePuzzles.Length; i++)
{
SimonSaysPuzzle puzzle = shapePuzzles[i];
if (i == currentPuzzle)
{
puzzle.gameObject.SetActive(true);
continue;
}
puzzle.gameObject.SetActive(false);
}
startPuzzleButton.onClick.AddListener(ButtonClicked);
}
private void ButtonClicked()
{
if (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!");
// }
}
}