wangguan
2020-12-14 6f40c69336d4dc61567d58880a2bb4952d69be95
Assets/Scripts/TowerDefense/Level/EndlessWave.cs
@@ -6,6 +6,7 @@
using TowerDefense.Agents;
using TowerDefense.Agents.Data;
using TowerDefense.Nodes;
using TowerDefense.UI.HUD;
namespace TowerDefense.Level
{
@@ -113,6 +114,22 @@
        protected virtual void SpawnCurrent()
        {
            if (EndlessGameUI.instance.state == EndlessGameUI.State.GameOver)
            {
                StopWave();
                // 让所有兵线上已经生成的所有agent播放一个死亡动画然后销毁
                WaveLineAgentInsMgr[] waveLineAgentIns = AgentInsManager.instance.GetWaveLineList();
                for (int i = 0; i < waveLineAgentIns.Length; ++i)
                {
                    while (waveLineAgentIns[i].listAgent.Count > 0)
                    {
                        waveLineAgentIns[i].listAgent[0].PlayDeath();
                    }
                }
                return;
            }
            if (isWaveStoped) return;
            if (!TrySetupNextSpawn())
@@ -148,9 +165,9 @@
            // 木属性小怪需要同时生成两个,先这么写吧(WTF)
            bool isDouble = enemyData.resource == 103;
            Poolable agentPoolable = Poolable.TryGetPoolable<Poolable>(AgentConfigurationList[index].agentPrefab.gameObject);
            Agent newAgent = agentPoolable.GetComponent<Agent>();
            GameObject prefab = Resources.Load<GameObject>($"Prefabs/Enemies/{enemyData.resource}");
            GameObject obj = Instantiate(prefab);
            Agent newAgent = obj.GetComponent<Agent>();
            newAgent.EnemyData = enemyData;
            newAgent.transform.position = StartingNode.transform.position;
@@ -177,8 +194,8 @@
            if (isDouble)
            {
                Poolable agentPoolable2 = Poolable.TryGetPoolable<Poolable>(AgentConfigurationList[index].agentPrefab.gameObject);
                Agent doubleAgent = agentPoolable2.GetComponent<Agent>();
                obj = Instantiate(prefab);
                Agent doubleAgent = obj.GetComponent<Agent>();
                doubleAgent.EnemyData = enemyData;
                doubleAgent.transform.position = StartingNode.transform.position;