public void SetTower(UnitTower tgtTower) { tower = tgtTower; if (thisObj == null) { Init(); } slider.value = tower.GetConstructionStatus(); UpdateScreenPosition(); }
void Update() { if (tower == null) { if (thisObj.activeInHierarchy) { thisObj.SetActive(false); } return; } slider.value = tower.GetConstructionStatus(); UpdateScreenPosition(); if (!tower.InConstruction()) { tower = null; thisObj.SetActive(false); } }