Пример #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.
     }
 }
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyIndex = 0; enemyIndex < waveConfig.GetNumberOfEnemies(); enemyIndex++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab()
             , waveConfig.GetWaypoints()[0].transform.position
             , Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Пример #3
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()));
     }
 }
Пример #4
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()));
     }
 }
Пример #5
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
        {
            var angle        = waveType == "Enemy" ? Quaternion.Euler(new Vector3(0, 0, 225)) : Quaternion.identity;
            var newCharacter = Instantiate(waveConfig.GetCharacterPrefab(), waveConfig.GetWaypoints()[0].transform.position, angle);

            newCharacter.GetComponent <Pathing>().SetWaveConfig(waveConfig);

            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }
 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); //significa "Nao precisamos de rotação"
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Пример #7
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()));
     }
 }
Пример #8
0
 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()));
     }
 }
Пример #9
0
    private IEnumerator SpawnEnemiesInWave(WaveConfig waveConfig)
    {
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            var newEnemy = Instantiate
                               (waveConfig.GetEnemyPrefab(),
                               waveConfig.GetWaypoints()[0].position,
                               Quaternion.identity);

            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
            yield return(new WaitForSeconds(waveConfig.GetSpawnDelay()));
        }
    }
Пример #10
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         GameObject enemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity) as GameObject;
         enemy.transform.SetParent(gameSpace);
         enemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Пример #11
0
 // 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()));
     }
 }
Пример #12
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()));
     }
 }
Пример #13
0
 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));
     }
 }
Пример #14
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()));
        }
    }
Пример #15
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()));
        }
    }
Пример #16
0
    }   // IEnumerator SpawnAllWaves()

    /***
    *		This coroutine spawns all enemies in a wave.	
    ***/
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        Debug.Log("Starting wave " + waveConfig.name);
        waveConfig.BuildShips();
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            Debug.Log("Spawning enemy #" + enemyCount + " for " + waveConfig.name);
            var newEnemy = waveConfig.GetEnemyShip(enemyCount);
            newEnemy.transform.position = waveConfig.GetWaypoints()[0].transform.position;
            newEnemy.GetComponent<EnemyPathing>().SetWaveConfig(waveConfig);
            level.AddEnemy();
            yield return new WaitForSeconds(waveConfig.GetTimeBetweenSpawns());
        }   // for
    }   // IEnumerator SpawnAllEnemiesInWave()
Пример #17
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()));
        }
    }
Пример #18
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        for (int index = 0; index < waveConfig.GetNumberOfEnemies(); ++index)
        {
            var newEnemy = Instantiate(waveConfig.GetEnemyPrefab(),
                                       waveConfig.GetWaypoints()[0].position,
                                       Quaternion.identity);

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

            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns() +
                                            Random.Range(0, waveConfig.GetSpawnRandomFactor())));
        }
    }
Пример #19
0
    //This Coroutine spawns all of the enemies in the wave that it is passed
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            //Creates an instances of the enemy based on the parameters passed.
            var newEnemy = Instantiate(waveConfig.GetEnemyPrefab(), waveConfig.GetWayPoints()[0].transform.position, Quaternion.identity);

            //Sets the wave config in EnemyPathing.cs
            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);

            //Yields based on the time between spawns in the waveconfig
            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }
Пример #20
0
    // Coroutine that spawns all enemies in a single wave
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            // Spawns an enemy
            var newEnemyWave = Instantiate(waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].transform.position, Quaternion.identity);

            // Make it follow it's wave path
            newEnemyWave.GetComponent <Pathing>().SetWaveConfig(waveConfig);

            // Wait it's wave TimeBetweenSpawns to spawn another enemy in the same wave
            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }
Пример #21
0
 // Generating # of enemies in a path
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             /* NEXT line: Initialize the enemy at the startign point of the of path */
             waveConfig.GetPath()[0].transform.position,
             Quaternion.identity
             );
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Пример #22
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()));
        }
    }
Пример #23
0
    private IEnumerator SpawnWaveEnemies(WaveConfig currWave)
    {
        for (var i = 0; i < currWave.GetNumberOfEnemies(); i++)
        {
            var newEnemy = Instantiate
                           (
                currWave.GetEnemyPrefab(),
                currWave.GetWaypoints()[0].transform.position,
                currWave.GetEnemyPrefab().transform.rotation
                           );

            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(currWave);
            yield return(new WaitForSeconds(currWave.GetTimeBetweenSpawns()));
        }
    }
Пример #24
0
    private IEnumerator SpawnAllEnemies(WaveConfig waveConfig)
    {
        for (var enemycount = 0; enemycount < waveConfig.GetNumberOfEnemies(); enemycount++)
        {
            var newEnemy = Instantiate(
                waveConfig.GetEnemyPrefab(),
                waveConfig.GetWaypoints()[0].transform.position,
                waveConfig.GetEnemyPrefab().transform.rotation
                );
            Debug.Log(newEnemy.transform.rotation);

            newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }
Пример #25
0
    private IEnumerator SpawnEnemies(WaveConfig waveConfig)
    {
        yield return(new WaitForSeconds(waveConfig.GetStartSpawningTime()));

        for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
        {
            var enemy = Instantiate(waveConfig.GetEnemyPrefab(),
                                    waveConfig.GetWaypoints()[0].transform.position,
                                    Quaternion.Euler(0, 0, 90));

            enemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);

            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }
Пример #26
0
 public IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         if (FindObjectOfType <Boss>().BossAlive() == true)
         {
             var newEnemy = Instantiate(
                 waveConfig.GetEnemyPrefab(),
                 GameObject.Find("Boss").transform.position,
                 Quaternion.identity);
             newEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
             yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
         }
     }
 }
Пример #27
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++)
     {
         var enemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         EnemyPathing enemyPathing = enemy.GetComponent <EnemyPathing>();
         enemyPathing.SetWaypoints(waveConfig.GetWaypoints());
         enemyPathing.SetMoveSpeed(waveConfig.GetMoveSpeed());
         spawnedEnemiesCounter++;
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
    IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        float enemyCounts = waveConfig.GetNumberOfEnemies();

        for (int enemyOrder = 0; enemyOrder < enemyCounts; enemyOrder++)
        {
            GameObject enemy = Instantiate(
                waveConfig.GetEnemyPrefab(),
                waveConfig.GetWayPoints()[0].transform.position,
                Quaternion.identity
                );
            enemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }
Пример #29
0
    private IEnumerator SpawnEnemies(WaveConfig currentWave)
    {
        for (int i = 0; i < currentWave.GetNumberOfEnemies(); i++)
        {
            GameObject enemy = Instantiate(
                currentWave.GetEnemyPrefab(),
                currentWave.GetWaypoints()[0].position,
                Quaternion.identity
                );

            enemy.GetComponent <EnemyPathing>().SetWaveConfig(currentWave);

            yield return(new WaitForSeconds(currentWave.GetSpawnCooldown()));
        }
    }
Пример #30
0
    // When calling this Corotuine, we need to specify which WaveConfig we want to spawn
    private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
    {
        for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
        {
            //spawn the enemy from
            //at the position specified by the waveConfig waypoints
            var newEnemy = Instantiate(
                waveConfig.GetEnemyPrefab(),
                waveConfig.GetWaypoints()[0].transform.position,
                Quaternion.identity);
            //the wave will be selected from here and the enemy applied to it
            newEnemy.GetComponent <ObstraclePathing>().SetWaveConfig(waveConfig);

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