From 17c6e8b6f2aee4ed9a15c886f54a73f0cb61b125 Mon Sep 17 00:00:00 2001
From: weixudong <weixudong4700@ktgame.com>
Date: Wed, 09 Dec 2020 17:14:59 +0800
Subject: [PATCH] Merge branch 'master' of ssh://172.16.1.52:8091/GemBattle into master

---
 Assets/Scripts/TowerDefense/UI/EndlessBossSkill/BossSkillBubbleBomb.cs |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/EndlessBossSkill/BossSkillBubbleBomb.cs b/Assets/Scripts/TowerDefense/UI/EndlessBossSkill/BossSkillBubbleBomb.cs
index 8d367d1..64fbb44 100644
--- a/Assets/Scripts/TowerDefense/UI/EndlessBossSkill/BossSkillBubbleBomb.cs
+++ b/Assets/Scripts/TowerDefense/UI/EndlessBossSkill/BossSkillBubbleBomb.cs
@@ -2,6 +2,7 @@
 using UnityEngine;
 using TowerDefense.Agents;
 using TowerDefense.Level;
+using TMPro;
 
 /**
  * 泡泡炸弹
@@ -169,6 +170,10 @@
                 config.DestroyTime = bubbleBomb.GetExplodeTime();
                 config.MoveSpeed = SkillData.effect[1];
                 bubbleBombList.Add(config);
+
+                bubbleBomb.Blood.SetPos();
+                bubbleBomb.Blood.SetRemainHitCount(config.NeedAttackCount);
+                bubbleBomb.Blood.ShowBlood();
             }
         }
 
@@ -228,6 +233,15 @@
             {
                 GameObject prefab = Resources.Load<GameObject>(prefabPath);
                 ret = GameObject.Instantiate(prefab);
+                BubbleBombAgent agent = ret.GetComponent<BubbleBombAgent>();
+
+                prefab = Resources.Load<GameObject>($"Prefabs/BubbleBombBlood");
+                GameObject bubbleBombBlood = GameObject.Instantiate(prefab);
+                GameObject bloodUI = GameObject.Find("MainUI/BloodUI");
+                bubbleBombBlood.transform.SetParent(bloodUI.transform, false);
+
+                agent.Blood = bubbleBombBlood.GetComponent<BubbleBombBlood>();
+                agent.Blood.Target = agent;
             }
 
             ret.SetActive(true);
@@ -243,6 +257,8 @@
         {
             if (obj != null)
             {
+                BubbleBombAgent agent = obj.GetComponent<BubbleBombAgent>();
+                agent.Blood.HideBlood();
                 obj.SetActive(false);
                 bubbleBombPool.Add(obj);
             }
@@ -257,6 +273,8 @@
             {
                 GameObject obj = bubbleBombPool[0];
                 bubbleBombPool.Remove(obj);
+                BubbleBombAgent agent = obj.GetComponent<BubbleBombAgent>();
+                GameObject.Destroy(agent.Blood.gameObject);
                 GameObject.Destroy(obj);
             }
         }
@@ -290,7 +308,7 @@
                     if (config.IsAttackDeath || config.IsArrived) return;
 
                     ++config.AttackCount;
-                    // Debug.Log($"---- BubbleBombAgent Id: {id}, AttackCount: {config.AttackCount} ----");
+                    config.Agent.Blood.SetRemainHitCount(config.NeedAttackCount - config.AttackCount);
 
                     if (config.AttackCount >= config.NeedAttackCount)
                         AgentDead(config);
@@ -314,6 +332,7 @@
 
                     if (config.IsAttackDeath || config.IsArrived) return;
 
+                    config.Agent.Blood.HideBlood();
                     AgentDead(config);
                     break;
                 }
@@ -350,6 +369,7 @@
         /// <param name="config"></param>
         private void AgentDead(BubbleBombConfig config)
         {
+            config.Agent.Blood.HideBlood();
             config.IsAttackDeath = true;
             AgentInsManager.instance.removeAgent(config.Agent);
             config.Agent.StopNormalEffect();
@@ -362,6 +382,7 @@
         /// <param name="config"></param>
         private void AgentArrived(BubbleBombConfig config)
         {
+            config.Agent.Blood.HideBlood();
             config.IsArrived = true;
             AgentInsManager.instance.removeAgent(config.Agent);
             config.Agent.StopNormalEffect();
@@ -436,11 +457,6 @@
                     }
                 }
             }
-        }
-
-        protected override List<int> GetTunelList()
-        {
-            return EndlessPortData.GetAllTunelByLevelWave(EndlessLevelManager.instance.CurrentLevel, EndlessLevelManager.instance.WaveManager.CurrentWaveIndex);
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1