From 69e0fea6c92fd4e153d45e5f26ef89baecf0405a Mon Sep 17 00:00:00 2001 From: weixudong <weixudong4700@ktgame.com> Date: Thu, 19 Nov 2020 08:51:09 +0800 Subject: [PATCH] Merge branch 'master' of ssh://172.16.1.52:8091/GemBattle into master --- Assets/Scripts/TowerDefense/Agents/Agent.cs | 34 +++++++++------------------------- 1 files changed, 9 insertions(+), 25 deletions(-) diff --git a/Assets/Scripts/TowerDefense/Agents/Agent.cs b/Assets/Scripts/TowerDefense/Agents/Agent.cs index 546bfa3..fc9a6ab 100644 --- a/Assets/Scripts/TowerDefense/Agents/Agent.cs +++ b/Assets/Scripts/TowerDefense/Agents/Agent.cs @@ -455,6 +455,12 @@ /// </summary> public override void Remove() { + GameObject prefab = Resources.Load<GameObject>("Prefabs/Endless/AgentDeathEffect"); + GameObject obj = Poolable.TryGetPoolable(prefab); + obj.transform.position = transform.position; + ParticleSystem ps = obj.transform.GetChild(0).GetComponent<ParticleSystem>(); + ps?.Play(); + // 统一管理器内删除当前的Agent: AgentInsManager.instance.removeAgent(this); EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessAgentDead, this); @@ -824,8 +830,6 @@ return; } - float atime = 0; - /// <summary> /// 更新动作信息. /// </summary> @@ -868,26 +872,6 @@ ActionState = state; if (ActionAnimator != null) ActionAnimator.SetInteger(paramName, (int)state); - } - - /// <summary> - /// 检查自身血量 - /// </summary> - private void CheckHealth() - { - if (this.healthVal <= 0.1) - { - Die(); - - //Debug.Log("删除多余的攻击Agent."); - } - } - - private void Die() - { - // 统一管理器内删除当前的Agent: - AgentInsManager.instance.removeAgent(this); - this.Remove(); } /// <summary> @@ -1079,6 +1063,8 @@ public override void PlayDeath() { + if (bInDeathAct) return; + if (isPoison) { isPoison = false; @@ -1103,10 +1089,8 @@ } } - ChangeState(AgentActionState.Death); - // 统一管理器内删除当前的Agent: - AgentInsManager.instance.removeAgent(this); bInDeathAct = true; + Remove(); } /// <summary> -- Gitblit v1.9.1