From ea02e4ac5c7759d244a2fa34880e5260cc5666df Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Wed, 18 Nov 2020 21:00:27 +0800
Subject: [PATCH] 修改UI 停止播放掉血特效 改变按钮位置

---
 Assets/Scripts/TowerDefense/UI/EndlessHomeBaseHPManager.cs |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/EndlessHomeBaseHPManager.cs b/Assets/Scripts/TowerDefense/UI/EndlessHomeBaseHPManager.cs
index bd56768..1cd087c 100644
--- a/Assets/Scripts/TowerDefense/UI/EndlessHomeBaseHPManager.cs
+++ b/Assets/Scripts/TowerDefense/UI/EndlessHomeBaseHPManager.cs
@@ -30,10 +30,14 @@
         /// </summary>
         public List<GameObject> HeartList;
 
+        public Text hpTxt;
+        public ParticleSystem ps;
+
         // Start is called before the first frame update
         private void Start()
         {
             CurrentHP = TotalHP = HeartList.Count;
+            hpTxt.text = "x" + CurrentHP.ToString();
             EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessLoseHeart, LoseHeart);
         }
 
@@ -51,24 +55,27 @@
         {
             if (CurrentHP == 0) return;
 
-            int preHP = CurrentHP;
-            int i = TotalHP - CurrentHP;
             CurrentHP = Mathf.Max(0, CurrentHP - count);
-            int num = preHP - CurrentHP;
-            int end = i + num;
+            // int preHP = CurrentHP;
+            // int i = TotalHP - CurrentHP;
+            // int num = preHP - CurrentHP;
+            // int end = i + num;
 
-            while (i < end)
-            {
-                Image img = HeartList[i].GetComponent<Image>();
-                Color c = img.color;
-                c.a = 0.17f;
-                img.color = c;
+            // while (i < end)
+            // {
+            //     Image img = HeartList[i].GetComponent<Image>();
+            //     Color c = img.color;
+            //     c.a = 0.17f;
+            //     img.color = c;
 
-                GameObject psObj = HeartList[i].transform.GetChild(0).gameObject;
-                ParticleSystem ps = psObj.transform.GetChild(0).GetComponent<ParticleSystem>();
-                ps.Play();
-                ++i;
-            }
+            //     GameObject psObj = HeartList[i].transform.GetChild(0).gameObject;
+            //     ParticleSystem ps = psObj.transform.GetChild(0).GetComponent<ParticleSystem>();
+            //     ps.Play();
+            //     ++i;
+            // }
+
+            hpTxt.text = "x" + CurrentHP.ToString();
+            //ps.Play();
 
             ViewPortAdj.instance.cachedCamera.DOShakePosition(0.25f, 1.5f, 4);//这里只可以震动3D场景中的东西
             MMVibrationManager.Haptic(HapticTypes.HeavyImpact);

--
Gitblit v1.9.1