chenxin
2020-12-02 98a535c132dc9aaa1a3bb9cffc9814c147a25b38
水精灵减速失效问题
3 files modified
109 ■■■■ changed files
Assets/Scripts/TowerDefense/Agents/Agent.cs 96 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Towers/Projectiles/BallisticAttack.cs 11 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs 2 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Agents/Agent.cs
@@ -270,7 +270,7 @@
        /// <param name="damage"></param>
        public void poisonAgent(float damage, int attid)
        {
            if (this.poisonTimes >= 1) return;
            if (poisonTimes >= 1) return;
            if (!isPoison)
            {
@@ -280,13 +280,13 @@
                    PoisonParticle.Play();
            }
            this.poisonTimes++;
            this.poisonAttid = attid;
            this.poisonHurt = (float)Math.Floor(this.configuration.maxHealth / 20.0f);
            this.timeToPoisonHurt = 1.0f;
            poisonTimes++;
            poisonAttid = attid;
            poisonHurt = (float)Math.Floor(configuration.maxHealth / 20.0f);
            timeToPoisonHurt = 1.0f;
        }
        public bool bInPoison { get { return this.poisonHurt > 0; } }
        public bool bInPoison { get { return poisonHurt > 0; } }
        /// <summary>
        /// 处理中毒相关的数据
@@ -294,11 +294,11 @@
        /// <param name="time"></param>
        protected void updatePoison(float time)
        {
            this.timeToPoisonHurt -= time;
            if (this.timeToPoisonHurt <= 0)
            timeToPoisonHurt -= time;
            if (timeToPoisonHurt <= 0)
            {
                Vector3 backPos = this.transform.position;
                this.TakeDamage(poisonHurt, this.transform.position, null, poisonAttid);
                Vector3 backPos = transform.position;
                TakeDamage(poisonHurt, transform.position, null, poisonAttid);
                // if ((poisonHurt > 0) && (!opponentAgent))
                // {
                //     if (GameUI.instanceExists)
@@ -322,7 +322,7 @@
        public bool bInDeathState
        {
            get { return this.bInDeathAct; }
            get { return bInDeathAct; }
            set { bInDeathAct = value; }
        }
@@ -343,7 +343,7 @@
        public NavMeshAgent navMeshAgent
        {
            get { return this.m_NavMeshAgent; }
            get { return m_NavMeshAgent; }
        }
        /// <summary>
@@ -377,7 +377,7 @@
        public float distanceToDest
        {
            get { return this.m_DisToDestination; }
            get { return m_DisToDestination; }
        }
        /// <summary>
@@ -449,11 +449,11 @@
        /// <param name="coinDrop"></param>     设置当前小怪的金币掉落数据
        public void SetAgentData(float health, float moveSpeed = -1, int coinDrop = 0)
        {
            this.configuration.maxHealth = health;
            this.configuration.startingHealth = health;
            this.configuration.SetMaxHealth(health);
            this.configuration.Init();
            this.configuration.SetHealth(health);
            configuration.maxHealth = health;
            configuration.startingHealth = health;
            configuration.SetMaxHealth(health);
            configuration.Init();
            configuration.SetHealth(health);
            // 只有在速度大于零的情况下才会设置.
            if (moveSpeed > 0)
@@ -462,11 +462,11 @@
            mLootDrop.lootDropped = coinDrop;
            mAgentData.speed = fMoveSpeed;
            mAgentData.hp = this.configuration.maxHealth;
            mAgentData.hp = configuration.maxHealth;
            //
            mStartYVal = this.transform.position.y;
            mStartZVal = this.transform.position.z;
            mStartYVal = transform.position.y;
            mStartZVal = transform.position.z;
            speedSlowRate = 0.0f;
            poisonHurt = 0;
@@ -531,7 +531,7 @@
            // 需要设置移动的目标Node.
            m_NextNode = m_CurrentNode.GetNextNode();
            this.MoveToNode();
            MoveToNode();
        }
        /// <summary>
@@ -644,10 +644,10 @@
            m_NavMeshAgent.enabled = false;
            // 必须要重置数据,不然会有一系列的小Bug.
            this.m_CurrentNode = null;
            m_CurrentNode = null;
            m_NextNode = null;
            this.liveID = this.liveID + 1;
            liveID = liveID + 1;
            speedSlowRate = 0.0f;
            poisonHurt = 0;
@@ -664,7 +664,7 @@
            if (WoodAimCount > 0)
                WoodAimCount = 0;
            StopWoodAimEffect();
            //this.SetTargetableMatColor(Color.white);
            //SetTargetableMatColor(Color.white);
            // 删除当前停止特效和状态.
            if (MoveStopTime > 0)
@@ -677,7 +677,7 @@
            }
            // 停止DoTween动画.
            this.transform.DOKill();
            transform.DOKill();
            Poolable.TryPool(gameObject);
        }
@@ -708,24 +708,24 @@
            // 
            // 设置一个DOTween队列,让场景内刷出来的Agent有一个变大淡出的效果,此时是无敌效果加持.
            this.configuration.bInvincible = true;
            mDefaultScale = this.transform.localScale;
            configuration.bInvincible = true;
            mDefaultScale = transform.localScale;
            Sequence agentTweenSeq = DOTween.Sequence();
            var ss = mDefaultScale * 0.3f;
            this.transform.localScale = this.transform.localScale * 0.3f;
            Tweener agScale = this.transform.DOScale(mDefaultScale, 0.3f);
            transform.localScale = transform.localScale * 0.3f;
            Tweener agScale = transform.DOScale(mDefaultScale, 0.3f);
            agentTweenSeq.Append(agScale);
            agentTweenSeq.AppendCallback(beDamageStart);
            this.nodeMoveUpdate = false;
            nodeMoveUpdate = false;
            // 获取移动速度
            fMoveSpeed = this.m_NavMeshAgent.speed / 2.0f;
            fMoveSpeed = m_NavMeshAgent.speed / 2.0f;
        }
        protected void beDamageStart()
        {
            this.configuration.bInvincible = false;
            configuration.bInvincible = false;
        }
        /// <summary>
@@ -733,16 +733,16 @@
        /// </summary>
        public void ResetAgentToInitialPos()
        {
            if (!this.initNode) return;
            if (!initNode) return;
            Vector3 initPos = this.initNode.GetRandomPointInNodeArea();
            Vector3 initPos = initNode.GetRandomPointInNodeArea();
            transform.position = initPos;
            ResetPositionData();
            this.SetNode(initNode, -1);
            SetNode(initNode, -1);
            // 更新AgentMgr,确保不再攻击回到原点的Agent.
            AgentInsManager.instance.updateInsMgrPos(this.opponentAgent);
            AgentInsManager.instance.updateInsMgrPos(opponentAgent);
        }
@@ -755,10 +755,10 @@
            if (configuration.bInvincible) return;
            // 只有处于非PosEffect状态才可以有这个状态.
            var posResetEff = this.GetComponent<AgentResetPosEffect>();
            var posResetEff = GetComponent<AgentResetPosEffect>();
            if (posResetEff == null)
            {
                posResetEff = this.gameObject.AddComponent<AgentResetPosEffect>();
                posResetEff = gameObject.AddComponent<AgentResetPosEffect>();
                // 初始化当前的PosResetEffect
                posResetEff.Initialize(3, AgentInsManager.instance.posResetFx);
@@ -901,7 +901,7 @@
                    return;
            }
            if (this.fMoveSpeed == 0)
            if (fMoveSpeed == 0)
            {
                Debug.Log("当前的移动为零:" + fMoveSpeed);
                return;
@@ -977,13 +977,13 @@
            // 根据是否到达一个结点来进行不同的处理
            if (swithNode)
            {
                this.MoveToNextNode(m_NextNode);
                MoveToNextNode(m_NextNode);
            }
            else
            {
                // Y值插值.
                float lerpVal = (curPos.z - mStartZVal) / (m_Destination.transform.position.z - mStartZVal);
                if (!this.opponentAgent)
                if (!opponentAgent)
                    // curPos.y = mStartYVal + lerpVal * 60f;
                    curPos.y = mStartYVal;
                m_NavMeshAgent.transform.position = curPos;
@@ -1043,7 +1043,7 @@
        /// </summary>
        protected virtual void LateUpdate()
        {
            this.UpdateAction();
            UpdateAction();
            HandleShieldWall();
            // 处理死亡状态了,不必再移动:
@@ -1053,7 +1053,7 @@
            updateAgentPos(Time.deltaTime);
            // 计算离目标的距离,非最终距离,只用于比较大小
            this.m_DisToDestination = this.GetDisToDestination();
            m_DisToDestination = GetDisToDestination();
            // 计算中毒相关.
            if ((poisonTimes > 0) && (poisonHurt > 0))
@@ -1091,7 +1091,7 @@
        {
            /*            // 设置最大的Z值,确保按路线移动
                        Vector3 pos = m_NavMeshAgent.transform.position;
                        if (this.m_PositiveZ)
                        if (m_PositiveZ)
                        {
                            if (pos.z > m_ZMaxValue)
                            {
@@ -1108,7 +1108,7 @@
                            }
                        }
                        // 设置X值的限制,确保按路线移动
                        if(this.m_PositiveX)
                        if(m_PositiveX)
                        {
                            if( pos.x > m_XMaxValue)
                            {
@@ -1160,9 +1160,9 @@
                tmpDis += NODE_DIS;
                tmpNode = tmpNode.GetNextNode();
            }
            Vector3 tpos = this.position;
            Vector3 tpos = position;
            tpos.y = mStartYVal;
            tmpDis += Vector3.Distance(tpos, this.m_Destination.transform.position);
            tmpDis += Vector3.Distance(tpos, m_Destination.transform.position);
            return tmpDis;
        }
Assets/Scripts/TowerDefense/Towers/Projectiles/BallisticAttack.cs
@@ -206,17 +206,16 @@
        /// 处理塔位的属性攻击
        /// </summary>
        /// <param name="enemy"></param>
        /// <param name="attid"></param>
        protected void ProcessTowerAttributeAttack(Targetable enemy, float damage, int attid)
        /// <param name="elfId">精灵Id</param>
        protected void ProcessTowerAttributeAttack(Targetable enemy, float damage, int elfId)
        {
            int id = (int)Math.Floor(attid / 10000.0f);
            switch (id)
            switch (elfId)
            {
                case 2:  // 减速.
                case 201:  // 减速.
                    SlowDown slowDown = (SlowDown)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.SlowDown);
                    (enemy as Agent).addSpeedSlowRate(0.15f + (slowDown != null ? slowDown.GetSlowDownAdd(TowerPtr.ElfId) : 0));
                    break;
                case 3:  // 中毒
                case 301:  // 中毒
                    // enemy.poisonAgent(damage, attid);
                    // enemy.SetTargetableMatColor(Color.green);
                    break;
Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
@@ -166,8 +166,6 @@
        int guide = PlayerPrefs.GetInt("GemBattleGuide");
        GameConfig.IsNewbie = guide == 0;
        GameConfig.IsNewbie = true;
        GameConfig.IsNewbieStart = GameConfig.IsNewbie;
        if (GameConfig.IsNewbie)