chenxin
2020-11-11 f2f4e1e45981bb294a5221ade7b4646cc3e29d35
Assets/Scripts/TowerDefense/Agents/Agent.cs
@@ -250,6 +250,11 @@
        public SpawnAgentType AgentType { get; set; } = SpawnAgentType.Normal;
        /// <summary>
        /// 无尽模式小怪对应 endless_enemy表中数据
        /// </summary>
        public endless_enemy EnemyData { get; set; }
        /// <summary>
        /// Accessor to <see cref="m_NavMeshAgent"/>
        /// </summary>
        public NavMeshAgent navMeshNavMeshAgent
@@ -296,6 +301,7 @@
        {
            this.configuration.maxHealth = health;
            this.configuration.startingHealth = health;
            this.configuration.SetMaxHealth(health);
            this.configuration.Init();
            this.configuration.SetHealth(health);
@@ -401,7 +407,7 @@
        /// 处理Agent的锁定Buf,播放特效,设置速度为零,并时间到达后重设数据。
        /// </summary>
        /// <param name="binfo"></param>
        protected void SetAgentStopBuff(buffinfo binfo)
        protected virtual void SetAgentStopBuff(buffinfo binfo)
        {
            MoveStopTime = binfo.last / 1000;
@@ -444,7 +450,7 @@
        {
            // 统一管理器内删除当前的Agent:
            AgentInsManager.instance.removeAgent(this);
            EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessAgentDead, this);
            base.Remove();
            if (m_LevelManager) m_LevelManager.DecrementNumberOfEnemies();
@@ -468,6 +474,8 @@
            timeToPoisonHurt = 0;
            bShieldBreak = false;
            bInDeathAct = false;
            configuration.ClearShieldWall();
            StopFrostParticle();
            //this.SetTargetableMatColor(Color.white);
@@ -838,7 +846,6 @@
                        // 统一管理器内删除当前的Agent:
                        AgentInsManager.instance.removeAgent(this);
                        this.Remove();
                        Debug.Log("删除多余的攻击Agent.");
                    }
                }
            }
@@ -876,6 +883,7 @@
        protected virtual void Update()
        {
            this.UpdateAction();
            HandleShieldWall();
            // 处理死亡状态了,不必再移动:
            if (bInDeathAct || !CanMove) return;
@@ -889,6 +897,25 @@
            // 计算中毒相关.
            if ((poisonTimes > 0) && (poisonHurt > 0))
                updatePoison(Time.deltaTime);
        }
        /// <summary>
        /// 处理魔法护盾血量值
        /// </summary>
        protected void HandleShieldWall()
        {
            if (configuration.IsExistShieldWall)
            {
                if (configuration.ShieldWallCurrentHealth <= 0.00001f)
                    configuration.IsExistShieldWall = false;
                else if (configuration.ShieldWallEffectiveTime > 0.00001f)
                {
                    if (configuration.ShieldWallRemainTime <= 0.00001f)
                        configuration.IsExistShieldWall = false;
                    else
                        configuration.ShieldWallRemainTime -= Time.deltaTime;
                }
            }
        }
        /// <summary>
@@ -1006,7 +1033,7 @@
            if (mAnim == null)
            {
                changeMat = GetComponent<ChangeMat>();
                changeMat?.SetSelf(this.opponentAgent, CheckHealth,Die);
                changeMat?.SetSelf(this.opponentAgent, CheckHealth, Die);
            }
        }
@@ -1025,6 +1052,7 @@
        public void PlayAttack()
        {
            AudioSourceManager.Ins.Play(AudioEnum.AttackTower);
            if (mAnim)
                mAnim.SetBool("Attack", true);
            else if (changeMat)