| | |
| | | using TowerDefense.Agents; |
| | | using TowerDefense.Agents.Data; |
| | | using TowerDefense.Nodes; |
| | | using TowerDefense.UI.HUD; |
| | | |
| | | namespace TowerDefense.Level |
| | | { |
| | |
| | | |
| | | 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()) |
| | |
| | | |
| | | // 木属性小怪需要同时生成两个,先这么写吧(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; |
| | | |
| | |
| | | int gold = waveData.Config.b_coin * enemyData.coin_rate; |
| | | |
| | | newAgent.SetAgentData(hp, speed, gold); |
| | | // todo 这里先填1级后面需要修改 |
| | | newAgent.healthBar.SetHealthLevel(1); |
| | | // 加入Manager统一管理. |
| | | AgentInsManager.instance.addAgent(newAgent); |
| | | |
| | | 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; |
| | | |
| | |
| | | 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) |
| | | /// 从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)) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 暂时先这么处理 cx test |
| | | /// 暂时先这么处理 |
| | | /// </summary> |
| | | /// <param name="resId">endless_enemy表的资源id</param> |
| | | /// <returns>所有可选的agent列表的索引</returns> |