// Update is called once per frame void Update() { if (isCanDownEnergy == false && downBarManagerUI.canDownEnergy(towerScriptTowerPrefab.energy)) { /*if (isCanDownEnergy == false) * { * * }*/ // color white // enabled script towerIcon.GetComponent <SpriteRenderer>().color = Color.white; itemUITowerIcon.enabled = true; isCanDownEnergy = true; } else if (isCanDownEnergy == true && downBarManagerUI.canDownEnergy(towerScriptTowerPrefab.energy) == false) { //color red // disabled script towerIcon.GetComponent <SpriteRenderer>().color = Color.red; itemUITowerIcon.enabled = false; isCanDownEnergy = false; } }