private void OnSpawnMonster(FBSpawnMonsterArgs args) { //创建怪物 string monsterName = "Monster" + args.MonsterID; GameObject go = FBGame.Instance.ObjectPool.Spawn(monsterName); FBMonster monster = go.GetComponent <FBMonster>(); monster.HPChangedAction += MonsterHPChanged; monster.DeadAction += MonsterDead; monster.ReachedAction += MonSterReched; monster.OnLoad(f_map.Path); }
IEnumerator RunRound() { f_roundIndex = -1; f_allRoundsComplete = false; for (int i = 0; i < f_rounds.Count; i++) { f_roundIndex = i; //回合开始 FBRoundStartArgs e = new FBRoundStartArgs { RoundIndex = f_roundIndex, RoundTotal = RoundTotal }; SendEvent(FBConsts.E_RoundStart, e); FBRound round = f_rounds[i]; for (int k = 0; k < round.Count; k++) { //出怪间隔 yield return(new WaitForSeconds(f_spawnInterval)); //出怪事件 FBSpawnMonsterArgs spawnArgs = new FBSpawnMonsterArgs { MonsterID = round.MonsterID }; SendEvent(FBConsts.E_SpawnMonster, spawnArgs); if (i == f_rounds.Count - 1 && k == round.Count - 1) { f_allRoundsComplete = true; } } //回合间隔 if (!f_allRoundsComplete) { yield return(new WaitForSeconds(f_roundInterval)); } } }