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().ValidRoomClicked += ValidRoomClicked; } } void ValidRoomClicked(object sender, Room room) { if (state == GameState.PickRoom) { room.SetRoomExplored(); } } }