Beispiel #1
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++) //GetNumberofEnemies [waveConfig.cs method to get number of enemies]
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),                     //GetEnemyPrefab [waveConfig.cs method to instantiate enemy]
             waveConfig.GetWaypoints()[0].transform.position, //GetWaypoints [waveConfig.cs method to get waypoints], [0] refers to the startingindex number which will be incremented
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns())); //runs the GetTimeBetweenSpawns method which returns the time for WaitForSeconds to use.
     }
 }
Beispiel #2
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig currentWave)
 {
     for (int i = 0; i < currentWave.GetNumberOfEnemies(); i++)
     {
         totalEnemies += 1;
         var newEnemy = Instantiate(currentWave.GetEnemyPrefab(),
                                    currentWave.GetWaypoints()[startingWave].transform.position,
                                    Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().setWaveConfig(currentWave);
         yield return(new WaitForSeconds(currentWave.GetTimeBetweenSpawns()));
     }
 }
Beispiel #3
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetNumOfEnemies(); i++)
     {
         var newEnemigo = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemigo.GetComponent <PathEnemigo>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Beispiel #4
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWayPoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig); // not sure why we had to do this instead of just leaving it as before
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig currentWave)
 {
     for(int i = 0; i < currentWave.NumberOfEnemies; i++)
     {
         var newEnemy = Instantiate(
         currentWave.GetEnemyPrefab(),
         currentWave.GetWaypoints()[0].transform.position,
         Quaternion.identity);
         newEnemy.GetComponent<EnemyPathing>().WaveConfig = currentWave;
         yield return new WaitForSeconds(currentWave.TimeBetweenSpawns);
     }
 }
Beispiel #6
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetnumberOfEnemies(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GettimeBetweenSpawns()));
     }
 }
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig currentWave)
    {
        int enemiesNumber = currentWave.GetNumberOfEnemies();

        for (int i = 0; i < enemiesNumber; i++)
        {
            var newEnemy = Instantiate(currentWave.GetEnemyPrefab(), currentWave.GetWaypoints()[0].transform.position, Quaternion.identity);
            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(currentWave);
            newEnemy.GetComponent <Enemy>().SetShotPeriod(currentWave.GetShotPeriod());
            yield return(new WaitForSeconds(currentWave.GetSpawnPeriod()));
        }
    }
Beispiel #8
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        for (int i = 0, maxEnemies = waveConfig.GetNumberOfEnemies(); i < maxEnemies; i++)
        {
            GameObject newEnemy = Instantiate(waveConfig.GetEnemyPrefab(),
                                              waveConfig.GetWaypoints()[0].transform.position,
                                              Quaternion.identity);

            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawn()));
        }
    }
 private IEnumerator SpawnAllEnemiesInThisWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetSpawnPeriod() + waveConfig.GetSpawnPeriodRandomizer()));
     }
 }
Beispiel #10
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            // Quaternion identity just says "we don't need rotation just use the rotation you already have."
            var newEnemy = Instantiate(waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].transform.position, Quaternion.identity);

            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);

            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns() * waveConfig.GetSpawnRandomFactor()));
        }
    }
Beispiel #11
0
 IEnumerator SpawnWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetNumOfEnemies(); i++)
     {
         enemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         enemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(StartCoroutine(Timer.Delay(waveConfig.GetSpawnInterval())));
     }
 }
Beispiel #12
0
 // loop w loopie loopie :)
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = startingWave; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);                 // <- oznacza to, zacznij roatcje od nowa - w skrocie
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Beispiel #13
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetEnemyCount(); i++)
     {
         GameObject enemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         enemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetSpawnWaitTime()));
     }
 }
Beispiel #14
0
 IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (var i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
     {
         var enemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWayPoints()[0].transform.position,
             Quaternion.identity);
         enemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpans()));
     }
 }
Beispiel #15
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig currentWave)
 {
     for (int enemyCount = 0; enemyCount <= currentWave.GetNumberOfEnemies(); enemyCount++)
     {
         var OneEnemy = Instantiate(
             currentWave.GetEnemyPrefab(),
             currentWave.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         OneEnemy.GetComponent <EnemyPathing>().SetWaveConfig(currentWave);
         yield return(new WaitForSeconds(currentWave.GetTimeBetweenSpaws()));
     }
 }
Beispiel #16
0
 IEnumerator SpawnEnemy()
 {
     for (float num = 0; num < waveConfig.GetNumberOfEnemy(); num++)
     {
         var spawnEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoint()[0].transform.position,
             Quaternion.identity);
         spawnEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
     }
     yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawn()));
 }
 private IEnumerator SpawnAllenemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 1; enemyCount <= waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         var enemy = Instantiate
                         (waveConfig.GetEnemyPrefab(),
                         waveConfig.GetWaypoints()[0].position,
                         Quaternion.identity);
         enemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig); //to make the EnemyPathing script reckonize the waveConfig in SerializeField
         float randomTime = Random.Range(0, waveConfig.GetSpawnRandomFactor());
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns() + randomTime));
     }
 }
Beispiel #18
0
 IEnumerator SpawnEnemies()
 {
     for (int i = 0; i <= waveConfig.GetNumOfEnemies(); i++)
     {
         waypoints = waveConfig.GetWaypoints();
         Instantiate(
             waveConfig.GetEnemyPrefab(),
             waypoints[0].transform.position,
             Quaternion.identity
             );
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Beispiel #19
0
    /// <summary>
    /// Spawn the specefic waveconfig to perform enemy movement
    /// </summary>
    /// <param name="wave">The waveconfig thats need to be followed to move an enemy.</param>
    /// <returns></returns>
    private IEnumerator SpawnEnemy(WaveConfig wave)
    {
        for (int i = 0; i < wave.GetNumberOfEnemy(); i++)
        {
            var newEnemy = Instantiate(
                wave.GetEnemyPrefab(),
                wave.GetEnemyWaypoints()[0].transform.position,
                Quaternion.identity);
            newEnemy.GetComponent <EnemyPathing>().waveConfig = wave;

            yield return(new WaitForSeconds(wave.GetTimeBetweenSpawns()));
        }
    }
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     // Generate GetNumberOfEnemies() number of enemies.
     for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
     {
         // generate a prefab object, pass in
         var newEnemy = Instantiate(waveConfig.GetEnemyPrefab(),                     // grab enemy prefab
                                    waveConfig.GetWaypoints()[0].transform.position, // spawn at initial position
                                    Quaternion.identity);                            // don't rotate
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Beispiel #21
0
 // A coroutine is a function that can suspend its execution (yield)
 // until the given YieldInstruction finishes.
 private IEnumerator SpawnEnemiesInOneWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetNumOfEnemies(); i++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWavepoints()[0].position,
             Quaternion.identity
             );
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetSpawnGap()));
     }
 }
 // For spawning enemies in current wave
 private IEnumerator SpawnAllEnemies(WaveConfig waveConfig)
 {
     // i corresponds to enemy count
     for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
     {
         // Creating enemies and spawning after specified delay
         var newEnemy = Instantiate(waveConfig.GetEnemyPrefab(),
                                    waveConfig.GetWaypoints()[0].transform.position,
                                    Quaternion.identity);
         newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Beispiel #23
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig _waveConfigs)
    {
        for (int _enemyCount = 0; _enemyCount < _waveConfigs.GetNumberOfEnemies(); _enemyCount++)
        {
            var _newEnemy = Instantiate(
                _waveConfigs.GetEnemyPrefab(),
                _waveConfigs.GetWaypoints()[0].transform.position,
                Quaternion.identity);
            _newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(_waveConfigs);

            yield return(new WaitForSeconds(_waveConfigs.GetTimeBetweenSpawns()));
        }
    }
 //1Wave中ですべての敵をSpawn
 //この関数は単に指定した回数、指定したObjectのInstanceを作成するだけである。
 //Insatanceのその後の挙動には全くタッチしないのでInstanceの挙動自体はEnemyPathスクリプトが行う。
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     //waveconfigで設定した敵の数の回数文だけForループを回す
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemy(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTBSpawn()));
     }
 }
Beispiel #25
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetEnemyNumber(); enemyCount++)
     {
         //each enemy created will be stored to new enemy
         var newEnemy =
             Instantiate(
                 waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].transform.position, Quaternion.identity);
         //pass in the waveconfig in this script to EnemyPathing
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBtwnSpawns()));
     }
 }
Beispiel #26
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
     {
         GameObject newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetSpawnPoint(),
             Quaternion.identity);
         // Change variables of enemy here
         newEnemy.GetComponent <AIPath>().maxSpeed = currentWave.GetMoveSpeed();
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Beispiel #27
0
    IEnumerator SpawnWave(WaveConfig waveConfig)
    {
        int waveEnemies = waveConfig.GetNumberOfEnemies();

        for (int enemyCount = 0; enemyCount < waveEnemies; enemyCount++)
        {
            Instantiate(
                waveConfig.GetEnemyPrefab(),
                waveConfig.GetWaypoints()[0].position,
                Quaternion.identity).GetComponent <EnemyPathing>().setWaveConfig(waveConfig);
            yield return(new WaitForSeconds(waveConfig.GetSpawnFreq()));
        }
    }
Beispiel #28
0
    private IEnumerator SpawnAllObjectsInWave(WaveConfig waveToSpawn)
    {
        for (int objectCount = 1; objectCount <= waveToSpawn.GetNumberOfObstacles(); objectCount++)
        {
            var newEnemy = Instantiate(
                waveToSpawn.GetEnemyPrefab(),
                waveToSpawn.GetWaypoints()[0].transform.position,
                Quaternion.identity);

            newEnemy.GetComponent <ObstaclePathing>().SetWaveConfig(waveToSpawn);

            yield return(new WaitForSeconds(waveToSpawn.GetTimeBetweenSpawns()));
        }
    }
Beispiel #29
0
    private IEnumerator SpawnWaveEnemies(WaveConfig waveConfig)
    {
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            var newEnemy = Instantiate(
                waveConfig.GetEnemyPrefab(),
                waveConfig.GetWaypoints()[0].position,
                Quaternion.Euler(0, 0, 180));

            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);

            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }
Beispiel #30
0
    // Start is called before the first frame update
    private IEnumerator SpawnAllEnemyInWave(WaveConfig waveConfig, int waveIndex)
    {
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            var newEnemy = Instantiate(waveConfig.GetEnemyPrefab(),
                                       waveConfig.GetWaypoints()[startingWave].transform.position,
                                       Quaternion.identity);
            newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
            Enemy targetEnemy = newEnemy.GetComponent <Enemy>();
            patternController.AddToCollection(enemyCount, waveIndex, targetEnemy);

            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpwan()));
        }
    }