From 344267a8edb7bc6eaa67a0493292f438d31ca20e Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Tue, 17 Nov 2020 21:10:57 +0800
Subject: [PATCH] buff补充

---
 Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs |   62 +++++++++++++++++++++++++++----
 1 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
index 3d2856b..2023709 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
+++ b/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)
                 {
@@ -891,9 +899,13 @@
                             allTowerP.Add(m_listTower[i].gridPosition);
                         }
                     }
+                    if (m_CurrentArea != null)
+                    {
+                        (m_CurrentArea as TowerPlacementGridEndless).CheckAllCanPlace(allTowerP);
+                        //(m_CurrentArea as TowerPlacementGridEndless).PlayPS(allPSTowerP);
+                    }
 
-                (m_CurrentArea as TowerPlacementGridEndless).CheckAllCanPlace(allTowerP);
-                    (m_CurrentArea as TowerPlacementGridEndless).PlayPS(allPSTowerP);
+
                 }
                 else if (m_CurrentTower.controller.towerFeature == EFeatureTower.Skill_Fire || m_CurrentTower.controller.towerFeature == EFeatureTower.Skill_Bomb)
                 {
@@ -1024,7 +1036,13 @@
                 TryPlaceTower(pointerInfo);
             else if (isFreeAttackGrid(pointerInfo) && !bSkill)
             {
-                if (!TryPlaceTower(pointerInfo, false, true)) return;
+                if (!TryPlaceTower(pointerInfo, false, true))
+                {
+                    CancelPlaceTower(pointerInfo);
+
+                    Debug.Log("这里需要返回原位");
+                    return;
+                }
 
                 // 删除towerToMove,确保塔防数据不再出现多个
                 if (towerToMove != null)
@@ -1688,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>
@@ -1708,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;
@@ -1726,6 +1763,7 @@
 
             if (ps == null)
                 ps = obj.transform.GetChild(0).GetComponent<ParticleSystem>();
+
             ps.Play();
             Destroy(obj, ps.main.duration);
         }
@@ -1760,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();
             }
 
             // 无法支付新的塔防价格,按钮变灰.
@@ -1785,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;
         }
@@ -1800,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)
             {

--
Gitblit v1.9.1