From dcbbe82ceca921e73e1789ae87ea8ac6a59c7bff Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Thu, 17 Dec 2020 15:54:41 +0800
Subject: [PATCH] 增加技能特效

---
 Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs |   46 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
index 89510c1..3814f55 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
+++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -144,7 +144,7 @@
         /// </summary>
         protected TextMeshProUGUI towerPriceText;
 
-        protected bool tdBuyDisable = false;
+        public bool tdBuyDisable { get; protected set; } = false;
 
         /// <summary>
         /// 鼠标在移动一个Tower之前,要隐藏的Tower数据和指针。
@@ -277,12 +277,12 @@
 
         //首次购买宝石特效
         public GameObject fireAppearEffect1;
-        public GameObject fireAppearEffect2;
+        //public GameObject fireAppearEffect2;
 
         public GameObject waterAppearEffect1;
-        public GameObject waterAppearEffect2;
+        //public GameObject waterAppearEffect2;
         public GameObject woodAppearEffect1;
-        public GameObject woodAppearEffect2;
+        //public GameObject woodAppearEffect2;
         /// <summary>
         /// 保存所有生成或合成的塔的最小等级
         /// </summary>
@@ -348,6 +348,25 @@
                     return lt;
             }
             return null;
+        }
+
+        /// <summary>
+        /// 根据塔位索引位置,查找位置上是否有对应的塔防数据。
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <returns></returns>
+        public int GetTowerNum()
+        {
+            int num = 0;
+            foreach (Tower lt in m_listTower)
+            {
+                if (lt.gridPosition.y == 0 || lt.gridPosition.y == 1)
+                {
+                    num++;
+                }
+            }
+            return num;
         }
 
         public bool towerInList(Tower t)
@@ -793,7 +812,9 @@
                     PlayUpgradeEffect(m_listTower[i]);
                 }
             }
+            GameConfig.IsUpgradeTowerLevel = true;
             UpdateMinLevelArr();
+            EndlessRandomTower.instance.UpdateDescDisplay();
         }
 
         /// <summary>
@@ -1133,7 +1154,7 @@
 
                         if (checkTowerPlaceTower != null)
                         {
-                            Debug.Log(checkTowerPlaceTower.name);
+                            //Debug.Log(checkTowerPlaceTower.name);
 
                             if (m_CurrentTower.controller.towerFeature == EFeatureTower.NULL)
                             {
@@ -1332,8 +1353,6 @@
                 //Debug.Log("IsSubstitute");
 
                 CheckCanChangePos(pointerInfo);
-                if (EndlessUIStart.instance.GameStartTime >= JsonDataCenter.DOUBLE_GEM_TIME)
-                    UpgradeAllTowerMinLevel(1);
             }
             else
                 CancelPlaceTower(pointerInfo);
@@ -1771,7 +1790,7 @@
                         CancelGhostPlacement();
                         return false;
                     }
-                    
+
                     PlaceGhost(pointer);
                 }
                 return true;
@@ -1919,7 +1938,7 @@
             {
                 //火元素
                 PlayAppearEffect(worldPos, fireAppearEffect1);
-                PlayAppearEffect(worldPos, fireAppearEffect2);
+                //PlayAppearEffect(worldPos, fireAppearEffect2);
                 if (Application.platform == RuntimePlatform.WindowsEditor)
                 {
                     //UnityEditor.EditorApplication.isPaused = true;
@@ -1929,14 +1948,14 @@
             {
                 //木元素
                 PlayAppearEffect(worldPos, woodAppearEffect1);
-                PlayAppearEffect(worldPos, woodAppearEffect2);
+                //PlayAppearEffect(worldPos, woodAppearEffect2);
 
             }
             else if (towerName.StartsWith("CopyCatTower"))
             {
                 //水元素
                 PlayAppearEffect(worldPos, waterAppearEffect1);
-                PlayAppearEffect(worldPos, waterAppearEffect2);
+                //PlayAppearEffect(worldPos, waterAppearEffect2);
             }
         }
         void PlayAppearEffect(Vector3 worldPos, GameObject prefab)
@@ -2070,7 +2089,7 @@
         /// <summary>
         /// 随机放置Tower按钮禁止使用,灰掉.
         /// </summary>
-        protected void disableRandomTowerBtn()
+        public void disableRandomTowerBtn()
         {
             randomTowerBtn.GetComponent<EndlessRandomTower>().ChangeBtnClick();
             //randomTowerBtn.interactable = false;
@@ -2085,7 +2104,7 @@
         /// <summary>
         /// 随机购买Tower的按钮重设置为有效.
         /// </summary>
-        protected void enableRandomTowerBtn()
+        public void enableRandomTowerBtn()
         {
             // ATTENTION TO FIX: 再次判断是因为有的地方是直接调用
             if ((TowerPrice.instance.currentTowerPrice > EndlessLevelManager.instance.Currency.currentCurrency) ||
@@ -2282,7 +2301,6 @@
             bool successfulPurchase = EndlessLevelManager.instance.Currency.TryPurchase(cost);
             if (!successfulPurchase) return false;
 
-            EndlessRandomTower.instance.UpdateDescDisplay();
             SetUpGhostTower(tow);
             //Debug.Log("设置影子塔防.");
             m_CurrentTower.Show();

--
Gitblit v1.9.1