From d6161eec964b2eeb23bd93c84c29f8ffd3a2d06f Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Thu, 05 Nov 2020 17:26:39 +0800
Subject: [PATCH] Merge commit '323055bb1b4c9b5669676dd799238050279b7d7a' into master

---
 Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
index 92083ef..9b1bd1b 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
+++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -694,6 +694,7 @@
         /// <param name="opponent"></param>
         public void DestroyTowerGrid(int xidx)
         {
+            // cx test 这里的逻辑已经不走了
             for (int i = 0; i < AttackRowNumbers; ++i)
             {
                 if (TowerDestroyArr[xidx, i]) continue;
@@ -753,11 +754,38 @@
                     }
                 }
 
-                // 红心减少逻辑
-                // HealthHeartState.instance.killHeart(false);
                 GameOver();
                 overTimer = new Timer(1.2f, SafelyCallGameOverEvent);
             }
+        }
+
+        /// <summary>
+        /// 爱心数量为0,游戏结束
+        /// </summary>
+        private void AllHeartLose()
+        {
+            // 清理技能
+            EndlessBossSkillManager.instance.ClearSkillList();
+
+            // 停止所有兵线的出兵
+            for (int i = 0; i < TotalWaveLines; ++i)
+            {
+                EndlessLevelManager.instance.StopWaveLine(i);
+            }
+
+            // 让所有兵线上已经生成的所有agent播放一个死亡动画然后销毁
+            WaveLineAgentInsMgr[] waveLineAgentIns = AgentInsManager.instance.GetWaveLineList();
+
+            for (int i = 0; i < waveLineAgentIns.Length; ++i)
+            {
+                while (waveLineAgentIns[i].listAgent.Count > 0)
+                {
+                    waveLineAgentIns[i].listAgent[0].PlayDeath();
+                }
+            }
+
+            GameOver();
+            overTimer = new Timer(1.2f, SafelyCallGameOverEvent);
         }
 
         private void SafelyCallGameOverEvent()
@@ -1527,6 +1555,7 @@
             if (placeObj != null)
                 m_CurrentArea = placeObj.GetComponent<IPlacementArea>();
             placeObj = GameObject.FindGameObjectWithTag("PlaceTowerOpponent");
+            EventCenter.Ins.Add((int)KTGMGemClient.EventType.EndlessHeartAllLose, AllHeartLose);
         }
 
         /// <summary>

--
Gitblit v1.9.1