2
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.5 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
namespace Game
{
public class NumAttacker
{
public EAIModuleType type;
public int num;
}
public partial class LevelNodeMonsterWave : LevelNode, ILevelMonsterWave
{
[Rename("攻击周期(秒)")] public float attackRound;
[Rename("攻击频率(秒/次)")] public float attackFrequency;
[Rename("攻击次数")] public int attackTimes;
[Rename("同时攻击人数")] public NumAttacker[] numAttackers;
private int _waveIndex;
private LevelNodeMonster[] _monsterList;
private readonly Dictionary<EAIModuleType, int> _numAttackerDict = new Dictionary<EAIModuleType, int>();
public override void OnInit()
{
_monsterList = GetComponentsInChildren<LevelNodeMonster>();
for (EAIModuleType i = 0; i < EAIModuleType.Max; i++)
{
_numAttackerDict[i] = 0;
}
if (numAttackers != null)
{
foreach (var item in numAttackers)
{
_numAttackerDict[item.type] += item.num;
}
}
}
public LevelNodeMonster[] GetMonsters()
{
return _monsterList;
}
public void SetWaveIndex(int index)
{
_waveIndex = index;
}
public int GetWaveIndex()
{
return _waveIndex;
}
}
}