chenxin
2020-11-17 344267a8edb7bc6eaa67a0493292f438d31ca20e
Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -109,6 +109,8 @@
        /// </summary>
        public Button randomTowerBtn;
        public Button SkillTowerBtn;
        /// <summary>
        /// 飘血数字对应的prefab.
        /// </summary>
@@ -128,6 +130,8 @@
        /// 购买塔防按钮上的Text.
        /// </summary>
        protected TextMeshProUGUI towerPriceText;
        protected TextMeshProUGUI towerPriceText1;
        protected bool tdBuyDisable = false;
@@ -254,6 +258,10 @@
        /// 宝石出现特效预制体
        /// </summary>
        public GameObject TowerAppearEffectPrefab;
        public GameObject TowerUpgradeEffectPrefabGuide;//新手导航特效Layer是UI
        public GameObject TowerAppearEffectPrefabGuide;//新手导航特效Layer是UI
        //首次购买宝石特效
        public GameObject fireAppearEffect1;
@@ -731,13 +739,13 @@
        /// <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)
                {
@@ -1030,7 +1038,7 @@
            {
                if (!TryPlaceTower(pointerInfo, false, true))
                {
                   CancelPlaceTower(pointerInfo);
                    CancelPlaceTower(pointerInfo);
                    Debug.Log("这里需要返回原位");
                    return;
@@ -1698,6 +1706,25 @@
            Destroy(obj, ps.main.duration);
        }
        public void PlayAppearEffectGuide(Vector3 worldPos)
        {
            GameObject obj = Instantiate(TowerAppearEffectPrefabGuide);
            obj.transform.position = worldPos;
            Vector3 pos = obj.transform.position;
            pos.y += 5f;
            obj.transform.position = pos;
            ParticleSystem ps = obj.GetComponent<ParticleSystem>();
            if (ps == null)
                ps = obj.transform.GetChild(0).GetComponent<ParticleSystem>();
            ps.Play();
            Destroy(obj, ps.main.duration);
        }
        /// <summary>
        /// 播放宝石出现特效
        /// </summary>
@@ -1718,17 +1745,17 @@
            Destroy(obj, ps.main.duration);
        }
        /// <summary>
        /// 播放升级特效
        /// </summary>
        /// <param name="worldPos"></param>
        public void GuidePlayUpgradeEffect(Vector3 position)
        {
            GameObject effect = TowerUpgradeEffectPrefab;
            // 在sTower的位置播放升级特效
            GameObject obj = Instantiate(effect);
            GameObject obj = Instantiate(TowerUpgradeEffectPrefabGuide);
            obj.transform.position = position;
            Vector3 pos = obj.transform.position;
            pos.y += 5f;
            obj.transform.position = pos;
@@ -1736,6 +1763,7 @@
            if (ps == null)
                ps = obj.transform.GetChild(0).GetComponent<ParticleSystem>();
            ps.Play();
            Destroy(obj, ps.main.duration);
        }
@@ -1770,12 +1798,16 @@
            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();
            }
            // 无法支付新的塔防价格,按钮变灰.
@@ -1795,6 +1827,7 @@
            if (towerPriceText)
            {
                towerPriceText.color = new Color(0.5f, 0.5f, 0.5f);
                towerPriceText1.color = new Color(0.5f, 0.5f, 0.5f);
            }
            tdBuyDisable = true;
        }
@@ -1810,7 +1843,10 @@
                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)
            {