public void ChangePanel(CreateTowerPanel panel) { if (selectedPanel == panel) { selectedPanel.HidePanel(); selectedPanel = null; } else { selectedPanel?.HidePanel(); selectedPanel = panel; selectedPanel?.ShowPanel(); } }
private IEnumerator Start() { yield return(new WaitUntil(() => { return TowerManager.inst != null; })); createTower = TowerManager.inst.GetTower(towerIndex); myBtn = GetComponent <Button>(); if (createTower != null) { rebuildTime = createTower.RebuildTime; totalTime = rebuildTime + 1f; image = GetComponent <Image>(); image.type = Image.Type.Filled; image.fillAmount = 1f; parent = transform.parent.GetComponent <CreateTowerPanel>(); StartCoroutine(CO_CheckCanInteractable()); } else { myBtn.interactable = false; } }