PuzzleGame/PuzzleGameProject/Assets/Scripts/GameManager.cs
2025-01-19 14:06:07 +01:00

30 lines
715 B
C#

using System;
using UnityEngine;
using Object = UnityEngine.Object;
public enum GameState
{
PickRoom
}
public class GameManager : MonoBehaviour
{
public GameState state;
public GameObject rooms;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
state = GameState.PickRoom;
foreach (Transform roomTransform in rooms.transform)
{
roomTransform.gameObject.GetComponent<Room>().ValidRoomClicked += ValidRoomClicked;
}
}
void ValidRoomClicked(object sender, Room room) {
if (state == GameState.PickRoom)
{
room.SetRoomExplored();
}
}
}