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.
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace Game
|
|
{
|
|
[System.Serializable]
|
|
public class NumAttacker
|
|
{
|
|
public EAIModuleType type;
|
|
public int num;
|
|
}
|
|
public class LevelNodeMonsterWave : LevelNode
|
|
{
|
|
[FormerlySerializedAs("AttackRound")] [Header("攻击周期(秒)")] public float attackRound;
|
|
[FormerlySerializedAs("AttackFrequency")] [Header("攻击频率(秒/次)")] public float attackFrequency;
|
|
[FormerlySerializedAs("AttackTimes")] [Header("攻击次数")] public int attackTimes;
|
|
[FormerlySerializedAs("NumAttackers")] [Header("同时攻击人数")] public NumAttacker[] numAttackers;
|
|
private int _mWaveIndex;
|
|
private LevelNodeMonster[] _mMonsterList;
|
|
private Dictionary<EAIModuleType, int> _mNumAttackerDict = new Dictionary<EAIModuleType, int>();
|
|
|
|
public override void OnInit()
|
|
{
|
|
_mMonsterList = GetComponentsInChildren<LevelNodeMonster>();
|
|
for (EAIModuleType i = 0; i < EAIModuleType.Max; i++)
|
|
{
|
|
_mNumAttackerDict[i] = 0;
|
|
}
|
|
for (int i = 0; i < numAttackers.Length; i++)
|
|
{
|
|
var item = numAttackers[i];
|
|
_mNumAttackerDict[item.type] += item.num;
|
|
}
|
|
}
|
|
public LevelNodeMonster[] GetMonsters()
|
|
{
|
|
return _mMonsterList;
|
|
}
|
|
public int GetModuleNum(EAIModuleType type)
|
|
{
|
|
return _mNumAttackerDict[type];
|
|
}
|
|
public void SetWaveIndex(int index)
|
|
{
|
|
_mWaveIndex = index;
|
|
}
|
|
public int GetWaveIndex()
|
|
{
|
|
return _mWaveIndex;
|
|
}
|
|
}
|
|
} |