chenxin
2020-10-29 960cb245d0a1a3005f436ebcc57d2faa5692164e
Assets/Scripts/TowerDefense/Level/EndlessWave.cs
@@ -1,4 +1,5 @@
using System;
using UnityEngine;
using System;
using System.Collections.Generic;
using Core.Utilities;
using KTGMGemClient;
@@ -142,14 +143,23 @@
        /// 生成agent
        /// </summary>
        /// <returns>Agent</returns>
        protected virtual Agent SpawnAgent()
        protected virtual void SpawnAgent()
        {
            int index = GetIndexByResId(waveData.EnemyData.resource);
            // 木属性小怪需要同时生成两个,先这么写吧(WTF)
            bool isDouble = waveData.EnemyData.resource == 103;
            Poolable agentPoolable = Poolable.TryGetPoolable<Poolable>(AgentConfigurationList[index].agentPrefab.gameObject);
            Agent newAgent = agentPoolable.GetComponent<Agent>();
            newAgent.transform.position = StartingNode.transform.position;
            if (isDouble)
            {
                Vector3 pos = newAgent.transform.position;
                pos.x -= 2f;
                newAgent.transform.position = pos;
            }
            newAgent.transform.rotation = StartingNode.transform.rotation;
            newAgent.SetNode(StartingNode, WaveLineId - 1);
            newAgent.opponentAgent = false;
@@ -166,7 +176,43 @@
            // 加入Manager统一管理.
            AgentInsManager.instance.addAgent(newAgent);
            return newAgent;
            if (isDouble)
            {
                Poolable agentPoolable2 = Poolable.TryGetPoolable<Poolable>(AgentConfigurationList[index].agentPrefab.gameObject);
                Agent doubleAgent = agentPoolable2.GetComponent<Agent>();
                doubleAgent.transform.position = StartingNode.transform.position;
                Vector3 pos = doubleAgent.transform.position;
                pos.x += 2f;
                doubleAgent.transform.position = pos;
                doubleAgent.transform.rotation = StartingNode.transform.rotation;
                doubleAgent.SetNode(StartingNode, WaveLineId - 1);
                doubleAgent.opponentAgent = false;
                doubleAgent.Initialize();
                doubleAgent.SetAgentData(hp, speed, gold);
                doubleAgent.healthBar.SetHealthLevel(1);
                AgentInsManager.instance.addAgent(doubleAgent);
            }
        }
        /// <summary>
      /// 从Tower的AttributeId获取到怪物的数据
      /// </summary>
      /// <param name="id"></param>
      /// <returns></returns>
      protected List<int> GetMonsterDataFromAttributeId(int id)
        {
            geminfo tgem = new geminfo();
            if (JsonDataCenter.gemInfoDic.TryGetValue(id, out tgem))
                return tgem.summon;
            else
            {
                Debug.Log("找不到对应ID的Gem:" + id);
                return null;
            }
        }
        /// <summary>