using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class UIBuildModeManager : MonoBehaviour { [SerializeField] private GameObject ShopUI; [SerializeField] private GameObject ConstructionUI; [SerializeField] private Button CancelButton; private void Start() { GameManager.OnUpdateUIRequested += UpdateBuildModeUI; UpdateBuildModeUI(false); CancelButton.onClick.AddListener(OnBuildCancel); } private void OnDisable() { GameManager.OnUpdateUIRequested -= UpdateBuildModeUI; } void UpdateBuildModeUI(bool isBuildMode) { ShopUI.SetActive(!GameManager.Instance.IsBuildMode); ConstructionUI.SetActive(GameManager.Instance.IsBuildMode); } public void OnBuildCancel() { TowerPlacementManager.Instance.FinishBuild(); } }