Exemple #1
0
    // Use this for initialization
    void Start()
    {
        var spawnPointCount = waveConfiguration.GetWaypoints().Count;

        if (!waveConfiguration.GetRandomSpawn() && spawnPointCount == 0)
        {
            bool isRandomSpawnOn = waveConfiguration.GetRandomSpawn();
            isRandomSpawnOn = true;
        }

        else
        {
            spawnPoints = waveConfiguration.GetWaypoints();
        }
    }
Exemple #2
0
    private IEnumerator SpawnAllBEATzInWave(WaveConfiguration waveConfig)
    {
        // For each number of BEATz that we will spawn in the scene, we will increment the BEAT count by 1.
        for (int BEATCount = 0; BEATCount < waveConfig.GetSpawnNumber(); BEATCount++)
        {
            // Local Variables
            // 1.) The BEAT that we will be spawning
            var BEAT = waveConfig.GetBEATPrefab();
            // 2.) The BEAT position on spawn
            var BEATPosition = waveConfig.GetWaypoints()[0].transform.position;
            // 3.) Spawn BEAT
            var newBEAT = Instantiate(BEAT, BEATPosition, Quaternion.identity);
            // 4.) The starting time of a spawn pattern.
            int startingSpawnDuration = 0;
            // 5.) The duration time of spawning BEATz
            float endingSpawnDuration = waveConfig.GetSpawnDuration();

            SpawnBEATz(waveConfig, BEAT, newBEAT);

            // Wait before spawning another BEAT.
            yield return(new WaitForSeconds(waveConfig.GetSpawnRate()));

            BEATCount = SpawnAnotherBEAT(waveConfig, BEATCount, startingSpawnDuration, endingSpawnDuration);

            // If delay is ON, then wait a second.
            if (waveConfig.GetDelay() && endingSpawnDuration == startingSpawnDuration)
            {
                yield return(new WaitForSeconds(waveConfig.GetDelayInterval()));
            }
        }
    }
Exemple #3
0
 void Start()
 {
     #region Get Waypoints Positions From waveConfig set in EnemySpawner.cs then set enemy position to first index
     wayPointsTransformList = waveConfig.GetWaypoints();
     transform.position     = wayPointsTransformList[wayPointIndex].position;
     #endregion
 }
    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());
    }
Exemple #5
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()));
     }
 }
Exemple #6
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()));
        }
    }
Exemple #7
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()));
        }
    }
Exemple #8
0
 // Start is called before the first frame update
 void Start()
 {
     waypoints          = waveConfiguration.GetWaypoints();
     transform.position = waypoints[waypointIndex].transform.position;
 }
Exemple #9
0
 // Start is called before the first frame update
 void Start()
 {
     waypoints = waveConfig.GetWaypoints();
     transform.position = waypoints[waypointIndex].position; /* sets position
         of enemy to 1st waypoint */
 }