private WaveCharacterInfoClass GetAvailableWaveCharacter(WavePhaseClass wavePhase) { CurrentWaveChar = wavePhase.ListOfEnemy.Where(r => r.NumberOfCharacter > 0).First(); CurrentWaveChar.NumberOfCharacter--; Events.AddRange(CurrentWaveChar.TypeOfCharacter.Events); Events = Events.Distinct().ToList(); return(CurrentWaveChar.TypeOfCharacter); }
private WaveCharacterInfoClass GetAvailableRandomWaveCharacter(WavePhaseClass wavePhase) { List <WaveCharClass> ListOfEnemy = wavePhase.ListOfEnemy.Where(r => r.NumberOfCharacter > 0).ToList(); CurrentWaveChar = ListOfEnemy[Random.Range(0, ListOfEnemy.Count)]; CurrentWaveChar.NumberOfCharacter--; Events.AddRange(CurrentWaveChar.TypeOfCharacter.Events); Events = Events.Distinct().ToList(); return(CurrentWaveChar.TypeOfCharacter); }
public IEnumerator SpawnCharFromGivenWave(string waveName, CharacterNameType characterID, string charIdentifier, bool isRandom, Vector2Int pos, bool removeFromWave) { WavePhaseClass wpc = WavePhases.Where(r => r.name == waveName).First(); CurrentWaveChar = wpc.ListOfEnemy.Where(a => a.TypeOfCharacter.CharacterName == characterID).First(); BaseCharacter newChar = GetWaveCharacter(CurrentWaveChar.TypeOfCharacter); if (removeFromWave) { CurrentWaveChar.NumberOfCharacter--; } FungusSpawnedChars.Add(charIdentifier, newChar); yield return(SpawChar(newChar, isRandom, pos, true)); }