コード例 #1
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfiguration waveConfig)
    {
        for (int enemyCounter = 0; enemyCounter < waveConfig.getNumberOfEnemies(); enemyCounter++)
        {
            GameObject SpawnedEnemy = Instantiate(waveConfig.GetEnemyPrefab() as GameObject, waveConfig.GetWaypoints()[0].position, Quaternion.identity);

            SpawnedEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
            yield return(new WaitForSeconds(waveConfig.getTimeBetweenSpawns()));
        }
    }
コード例 #2
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfiguration waveConfiguration)
 {
     for (int enemyCount = 0; enemyCount < waveConfiguration.GetNumberEnemies(); enemyCount++)
     {
         GameObject newEnemy = Instantiate(waveConfiguration.GetEnemyPrefab(),
                                           waveConfiguration.GetWayPoints()[0].transform.position, Quaternion.identity);
         newEnemy.GetComponent <EnemyFollowPath>().SetWaveConfig(waveConfiguration);
         yield return(new WaitForSeconds(waveConfiguration.GetTimeBeetweenSpaws()));
     }
 }
コード例 #3
0
    private void SpawnEnemy(WaveConfiguration waveConfiguration)
    {
        List <Transform> waypoints = waveConfiguration.GetWaypoints();

        GameObject   enemy           = Instantiate(waveConfiguration.GetEnemyPrefab(), waypoints[1].position, Quaternion.identity);
        EnemyPathing enemyController = enemy.GetComponent <EnemyPathing>();

        enemyController.SetWaypoints(waypoints);
        enemyController.SetMovementSpeed(waveConfiguration.GetMovementSpeed());
    }
コード例 #4
0
 private IEnumerator SpawnAllEnemies(WaveConfiguration waveConfig) /* coroutine
                                                                    * that spawns enemies in a wave configuration */
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfiguration(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetSpawnTime()));
     }
 }
コード例 #5
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfiguration waveConfiguration)
    {
        for (int enemyCount = 0; enemyCount < waveConfiguration.GetNumberOfEnemies(); enemyCount++)
        {
            var newEnemy = Instantiate(
                waveConfiguration.GetEnemyPrefab(),
                waveConfiguration.GetWaypoints()[0].transform.position,
                Quaternion.identity
                );

            newEnemy.GetComponent <EnemyPathing>().SetWaveConfiguration(waveConfiguration);

            yield return(new WaitForSeconds(waveConfiguration.GetSpawnIntervalTime()));
        }
    }