chenxin
2020-11-26 b3597e5148e64a08abe5730396c4018ccfa76e22
Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs
@@ -346,6 +346,7 @@
                if (woodChargeEffectTime <= 0 && woodChargeEffect != null)
                {
                    towerPtr.IsWoodCharge = false;
                    CancelWoodAim();
                    Destroy(woodChargeEffect);
                    woodChargeEffect = null;
@@ -383,9 +384,10 @@
                if (woodAimAgent == null)
                {
                    woodAimAgent = agent;
                    towerPtr.WoodAimAgent = agent;
                    if (agent.WoodAimCount == 0)
                        agent.WoodAimEffect.Play();
                        agent.PlayWoodAimEffect();
                    ++agent.WoodAimCount;
                }
@@ -397,14 +399,14 @@
                        --woodAimAgent.WoodAimCount;
                        if (woodAimAgent.WoodAimCount == 0)
                        {
                            woodAimAgent.WoodAimEffect.Stop();
                            woodAimAgent.WoodAimEffect.Clear();
                        }
                            woodAimAgent.StopWoodAimEffect();
                    }
                    woodAimAgent = agent;
                    towerPtr.WoodAimAgent = agent;
                    if (agent.WoodAimCount == 0)
                        agent.WoodAimEffect.Play();
                        agent.PlayWoodAimEffect();
                    ++agent.WoodAimCount;
                }
@@ -444,14 +446,14 @@
        /// </summary>
        private void CancelWoodAim()
        {
            if (woodAimAgent != null && woodAimAgent.WoodAimCount > 0)
            if (woodAimAgent != null)
            {
                --woodAimAgent.WoodAimCount;
                if (woodAimAgent.WoodAimCount == 0)
                if (woodAimAgent.WoodAimCount > 0)
                {
                    woodAimAgent.WoodAimEffect.Stop();
                    woodAimAgent.WoodAimEffect.Clear();
                    --woodAimAgent.WoodAimCount;
                    if (woodAimAgent.WoodAimCount == 0)
                        woodAimAgent.StopWoodAimEffect();
                }
            }
@@ -586,6 +588,10 @@
                    towerPtr.PlayEnergyEffect(true);
                }
            }
            // 如果在木属性蓄力期间,让瞄准动画播放
            if (towerPtr && towerPtr.IsWoodCharge && woodAimAgent != null)
                woodAimAgent.PlayWoodAimEffect();
        }
        /// <summary>
@@ -617,7 +623,7 @@
        /// </summary>
        protected virtual void Update()
        {
            if (m_Launcher == null) return;
            if (m_Launcher == null || towerPtr != null && !towerPtr.CanAttack) return;
            // 处理当前Affector所在Tower对应的技能
            updateTowerSkillData();
@@ -694,6 +700,7 @@
                if (bnum - 1 >= 0 && bnum - 1 < critBulletNum)
                {
                    woodRemainChargeTime = woodChargeTime;
                    towerPtr.IsWoodCharge = true;
                    DecreaseWoodChargeTime decreaseWoodChargeTime = (DecreaseWoodChargeTime)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.DecreaseWoodChargeTime);
                    if (decreaseWoodChargeTime != null)
@@ -701,6 +708,7 @@
                    woodChargeEffectTime = woodRemainChargeTime + 0.5f / towerLevel.ActionAnimator.speed;
                    woodChargeEffect = Instantiate(WoodChargeEffect);
                    woodChargeEffect.transform.SetParent(gameObject.transform);
                    woodChargeEffect.transform.SetPositionAndRotation(WoodChargeTransform.position, WoodChargeTransform.rotation);
                    ParticleSystem ps = woodChargeEffect.transform.GetChild(0).GetComponent<ParticleSystem>();
                    ps.Play();