From bac1e673b54b1e5f773c4bd098e1b4fe8981c62e Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Tue, 27 Oct 2020 20:39:17 +0800
Subject: [PATCH] Merge branch 'master' of ssh://172.16.1.52:8091/GemBattle

---
 Assets/Scripts/TowerDefense/Agents/Agent.cs |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/Agents/Agent.cs b/Assets/Scripts/TowerDefense/Agents/Agent.cs
index daef255..d7e7342 100644
--- a/Assets/Scripts/TowerDefense/Agents/Agent.cs
+++ b/Assets/Scripts/TowerDefense/Agents/Agent.cs
@@ -193,6 +193,12 @@
         protected bool bInDeathAct = false;
 
         /// <summary>
+        /// 原地罚站
+        /// </summary>
+        /// <param name="can"></param>
+        public bool CanMove { get; set; } = true;
+
+        /// <summary>
         /// Gets the attached nav mesh agent velocity
         /// </summary>
         public override Vector3 velocity
@@ -314,6 +320,7 @@
             poisonTimes = 0;
             timeToPoisonHurt = 0;
             bShieldBreak = false;
+            CanMove = true;
 
             /*// 如果对应的粒子不为空,则播放
 			if( spawnParticle)
@@ -404,7 +411,11 @@
                 if (MoveStopEffect)
                     return;
 
-                MoveStopEffect = Instantiate(WaveLineSelMgr.instance.bufStopMovePrefab);
+                GameObject obj = Instantiate(WaveLineSelMgr.instance.bufStopMovePrefab);
+                MoveStopEffect = obj.GetComponent<ParticleSystem>();
+
+                if (MoveStopEffect == null)
+                    MoveStopEffect = obj.transform.GetChild(0).GetComponent<ParticleSystem>();
                 MoveStopEffect.transform.position = this.position;
                 MoveStopEffect.Play();
             }
@@ -417,7 +428,11 @@
                 if (MoveStopEffect)
                     return;
 
-                MoveStopEffect = Instantiate(EndlessWaveLineManager.instance.bufStopMovePrefab);
+                GameObject obj = Instantiate(EndlessWaveLineManager.instance.bufStopMovePrefab);
+                MoveStopEffect = obj.GetComponent<ParticleSystem>();
+
+                if (MoveStopEffect == null)
+                    MoveStopEffect = obj.transform.GetChild(0).GetComponent<ParticleSystem>();
                 MoveStopEffect.transform.position = this.position;
                 MoveStopEffect.Play();
             }
@@ -848,7 +863,7 @@
             this.UpdateAction();
 
             // 处理死亡状态了,不必再移动:
-            if (bInDeathAct) return;
+            if (bInDeathAct || !CanMove) return;
 
             m_Destination = initNode.GetNextNode();
             updateAgentPos(Time.deltaTime);
@@ -991,6 +1006,19 @@
         {
             if (mAnim)
             {
+                if (isPoison)
+                {
+                    isPoison = false;
+                    // 移除Agent身上的中毒特效,并播放一个中毒效果消失的特效
+                    if (PoisonParticle != null)
+                    {
+                        PoisonParticle.Clear();
+                        PoisonParticle.Stop();
+                        if (PoisonEndParticle != null)
+                            PoisonEndParticle.Play();
+                    }
+                }
+
                 mAnim.SetBool("Die", true);
                 // 统一管理器内删除当前的Agent:
                 AgentInsManager.instance.removeAgent(this);

--
Gitblit v1.9.1