chenxin
2020-11-25 56f409504f41dc514a75f39995d11f86aec07e34
玉米瞄准bug修改
6 files modified
131 ■■■■■ changed files
Assets/Materials/UI/tileTowerVSMat.mat 2 ●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs 21 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Agents/Agent.cs 24 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Level/AgentInsManager.cs 65 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Towers/Tower.cs 11 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/EndlessSettlement.cs 8 ●●●● patch | view | raw | blame | history
Assets/Materials/UI/tileTowerVSMat.mat
@@ -40,7 +40,7 @@
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MainTex:
        m_Texture: {fileID: 2800000, guid: 93f40a01d57fbff418fc0b54b6ab7d9f, type: 3}
        m_Texture: {fileID: 2800000, guid: 8c9a3d26120e78f40aa4ef9ed23d573c, type: 3}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MetallicGlossMap:
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;
                }
@@ -449,10 +451,7 @@
                --woodAimAgent.WoodAimCount;
                if (woodAimAgent.WoodAimCount == 0)
                {
                    woodAimAgent.WoodAimEffect.Stop();
                    woodAimAgent.WoodAimEffect.Clear();
                }
                    woodAimAgent.StopWoodAimEffect();
            }
            woodAimAgent = null;
@@ -694,6 +693,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 +701,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();
Assets/Scripts/TowerDefense/Agents/Agent.cs
@@ -504,6 +504,27 @@
        }
        /// <summary>
        /// 播放木属性瞄准特效
        /// </summary>
        public void PlayWoodAimEffect()
        {
            if (WoodAimEffect == null || WoodAimEffect.isPlaying) return;
            WoodAimEffect.Play();
        }
        /// <summary>
        /// 停止木属性瞄准特效
        /// </summary>
        public void StopWoodAimEffect()
        {
            if (WoodAimEffect == null || !WoodAimEffect.isPlaying) return;
            WoodAimEffect.Stop();
            WoodAimEffect.Clear();
        }
        /// <summary>
        /// Stops the navMeshAgent and attempts to return to pool
        /// </summary>
        public override void Remove()
@@ -552,8 +573,7 @@
            if (WoodAimCount > 0)
                WoodAimCount = 0;
            WoodAimEffect.Stop();
            WoodAimEffect.Clear();
            StopWoodAimEffect();
            //this.SetTargetableMatColor(Color.white);
            // 删除当前停止特效和状态.
Assets/Scripts/TowerDefense/Level/AgentInsManager.cs
@@ -11,6 +11,7 @@
using UnityEngine;
using UnityEngine.AI;
using TowerDefense.Level;
using TowerDefense.Towers;
/// <summary>
/// 基于兵线的Agent Instance管理器
@@ -883,44 +884,58 @@
    /// 每一帧更新,更新之后获取几个刚性数据:
    /// 1:血量最多的AgentInstance.
    /// 2:最前面的AgentInstance.
    /// 3:
    /// </summary>
    void Update()
    {
        this.updateAgent();
        this.updateOpponentAgent();
        UpdateWoodAim();
    }
        // 测试重设最前面的Agent到初始化位置:
        if (Input.GetKeyDown(KeyCode.A))
    /// <summary>
    /// 更新木属性精灵瞄准
    /// </summary>
    private void UpdateWoodAim()
    {
        if (!EndlessLevelManager.instanceExists) return;
        WaveLineAgentInsMgr[] mgrs = GetWaveLineList();
        for (int i = 0; i < 5; ++i)
        {
            // 测试数据,重设Agent到开始位置
            if (agentInsList.Count >= 2)
            List<Agent> agents = mgrs[i].listAgent;
            // 是否发现有正在蓄力的木属性精灵
            bool findCharge = false;
            Tower tower = null;
            if (agents.Count == 0) continue;
            for (int j = 2; j <= 3; ++j)
            {
                /*   var posResetEff = MinDisAgent.GetComponent<AgentResetPosEffect>();
                   if (posResetEff == null)
                   {
                       posResetEff = MinDisAgent.gameObject.AddComponent<AgentResetPosEffect>();
                   }
                   posResetEff.Initialize(4, posResetFx );*/
                var lightBolt = agentInsList[1].GetComponent<LightBoltEffect>();
                if (lightBolt == null)
                tower = EndlessGameUI.instance.FindTowerWithGridIdx(i, j);
                if (!tower || !tower.gameObject.activeInHierarchy || tower.attributeId != 109) continue;
                if (tower.IsWoodCharge)
                {
                    lightBolt = agentInsList[1].gameObject.AddComponent<LightBoltEffect>();
                    findCharge = true;
                    break;
                }
                lightBolt.Initialize(2, lightBoltFx, lightHitFx, agentInsList[1], agentInsList[0]);
            }
            if (!findCharge)
            {
                for (int j = 0; j < agents.Count; ++j)
                {
                    agents[j].StopWoodAimEffect();
                }
            }
            else
            {
                if (tower.WoodAimAgent != null)
                    tower.WoodAimAgent.PlayWoodAimEffect();
            }
        }
        /*
        // TEST CODE TO DELETE:
        if( Input.GetKeyDown( KeyCode.S ))
        {
            this.moveAllAgentToCenter();
        }
        if( Input.GetKeyDown( KeyCode.D))
        {
            Targetter.bSearchTarget = !Targetter.bSearchTarget;
        }*/
    }
    /// <summary>
Assets/Scripts/TowerDefense/Towers/Tower.cs
@@ -8,6 +8,7 @@
using TowerDefense.Towers.Placement;
using TowerDefense.UI.HUD;
using UnityEngine;
using TowerDefense.Agents;
namespace TowerDefense.Towers
{
@@ -134,6 +135,16 @@
        public bool PlayWaveLineFlash { get; set; } = true;
        /// <summary>
        /// 是否是木属性蓄力状态
        /// </summary>
        public bool IsWoodCharge { get; set; }
        /// <summary>
        /// 木属性蓄力瞄准的目标
        /// </summary>
        public Agent WoodAimAgent;
        /// <summary>
        /// 塔防数据的局内升级
        /// </summary>
        public int inSceneTowerLevel
Assets/Scripts/TowerDefense/UI/EndlessSettlement.cs
@@ -88,10 +88,10 @@
            canvasGroup.interactable = false;
            return;
            RefreshFinalWave();
            RefreshPropList();
            SettlementUI.SetActive(true);
            PlayEffect();
            // RefreshFinalWave();
            // RefreshPropList();
            // SettlementUI.SetActive(true);
            // PlayEffect();
        }
        private void PlayEffect()