| | |
| | | /// </summary> |
| | | public Button randomTowerBtn; |
| | | |
| | | public Button SkillTowerBtn; |
| | | |
| | | /// <summary> |
| | | /// 飘血数字对应的prefab. |
| | | /// </summary> |
| | |
| | | /// 购买塔防按钮上的Text. |
| | | /// </summary> |
| | | protected TextMeshProUGUI towerPriceText; |
| | | |
| | | protected TextMeshProUGUI towerPriceText1; |
| | | |
| | | protected bool tdBuyDisable = false; |
| | | |
| | |
| | | /// <param name="tower"></param> |
| | | protected void growUpTower(Tower tower) |
| | | { |
| | | Tower newTower = EndlessRandomTower.instance.GetRandomTower(false); |
| | | Tower newTower = EndlessRandomTower.instance.GetRandomTower(EFeatureTower.NULL, true); |
| | | |
| | | // 所有的Tower不能升级成为FeatureTower. |
| | | int maxLoop = 20; |
| | | while (newTower.towerFeature != EFeatureTower.NULL) |
| | | { |
| | | newTower = EndlessRandomTower.instance.GetRandomTower(false); |
| | | newTower = EndlessRandomTower.instance.GetRandomTower(EFeatureTower.NULL, true); |
| | | maxLoop--; |
| | | if (maxLoop <= 0) |
| | | { |
| | |
| | | if (!towerPriceText) |
| | | { |
| | | towerPriceText = randomTowerBtn.transform.Find("cashText").GetComponent<TextMeshProUGUI>(); |
| | | towerPriceText1 = SkillTowerBtn.transform.Find("cashText").GetComponent<TextMeshProUGUI>(); |
| | | if (towerPriceText) |
| | | towerPriceText.text = tpMgr.currentTowerPrice.ToString(); |
| | | if (towerPriceText1) |
| | | towerPriceText1.text = tpMgr.currentTowerPrice.ToString(); |
| | | } |
| | | else |
| | | { |
| | | towerPriceText.text = tpMgr.currentTowerPrice.ToString(); |
| | | towerPriceText1.text = tpMgr.currentTowerPrice.ToString(); |
| | | } |
| | | |
| | | // 无法支付新的塔防价格,按钮变灰. |
| | |
| | | if (towerPriceText) |
| | | { |
| | | towerPriceText.color = new Color(0.5f, 0.5f, 0.5f); |
| | | towerPriceText1.color = new Color(0.5f, 0.5f, 0.5f); |
| | | } |
| | | tdBuyDisable = true; |
| | | } |
| | |
| | | return; |
| | | |
| | | if (towerPriceText) |
| | | { |
| | | towerPriceText.color = new Color(1.0f, 1.0f, 1.0f); |
| | | towerPriceText1.color = new Color(1.0f, 1.0f, 1.0f); |
| | | } |
| | | |
| | | if (randomTowerBtn) |
| | | { |