コード例 #1
0
ファイル: WaveSpawner.cs プロジェクト: LadyCookie/TimeTricker
    IEnumerator SpawnWave(Wave p_wave)
    {
        Debug.Log("Spwaning wave : " + p_wave.name);
        state = SpawnState.SPAWNING;
        if (m_chrono)
        {
            m_chrono.SpawningMode();
        }
        if (m_waveCounter)
        {
            m_waveCounter.SetWaveValue(++waveCount);
        }

        for (int enemyTypeIndex = 0; enemyTypeIndex < p_wave.enemyType.Length; enemyTypeIndex++)
        {
            for (int countOfEnemy = 0; countOfEnemy < p_wave.enemyType[enemyTypeIndex].count; countOfEnemy++)
            {
                SpawnEnemy(p_wave.enemyType[enemyTypeIndex].enemy);
                yield return(new WaitForSeconds(1.0f / p_wave.enemyType[enemyTypeIndex].rate));
            }
        }

        if (m_chrono)
        {
            m_chrono.DefaultMode();
        }
        state = SpawnState.WAITING;
        yield break;
    }