using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; using Level; public class InitializeLevelUI : MonoBehaviour { [SerializeField] private GameObject uiContainer; [SerializeField] private TextMeshProUGUI widthText; [SerializeField] private TextMeshProUGUI heightText; private int width = 5; private int height = 5; // Properties private int Width { get { return width; } set { width = value; widthText.text = width.ToString(); } } private int Height { get { return height; } set { height = value; heightText.text = height.ToString(); } } private void Awake() { uiContainer.SetActive(false); Width = 5; Height = 5; } private void Start() { GameManager.Instance.GameStateChanged += OnGameStateChanged; } public void ToggleUI() { uiContainer.SetActive(!uiContainer.activeSelf); } public void ChangeWidth(int delta) { Width += delta; Width = Mathf.Clamp(Width, 3, 100); } public void ChangeHeight(int delta) { Height += delta; Height = Mathf.Clamp(Height, 3, 100); } public void Initialize() { LevelBuilder.Instance.CreateLayout(Width, Height); uiContainer.SetActive(false); } private void OnGameStateChanged(GameState newState) { if (newState == GameState.Gameplay) { uiContainer.SetActive(false); } } }