Exemple #1
0
        private void LaunchWave()
        {
            Wave wave = new Wave();

            wave.endWave    = false;
            wave.spawnCount = 0;
            wave.count      = (int)amount.Init(firstWave);
            wave.waitTime   = waitingTime.Init(firstWave);

            waves.Add(wave);

            waveCount++;
            onWaveStart.Invoke();

            float repeatingTime = frequency.Init(firstWave);

            if (repeatingTime > 0)
            {
                InvokeRepeating("SpawnEntity", 0, repeatingTime);
            }
            else
            {
                onSpawnerEnd.Invoke();
                waves.Clear();
                isStarting = false;
            }

            firstWave = false;
        }
Exemple #2
0
    public void Init(MapData mapData, GameObjectScriptablePool enemyPool)
    {
        m_MapData     = mapData;
        m_EnemyPool   = enemyPool;
        m_CurrentWave = mapData.m_BoxymonWaves.Dequeue();
        OnWaveStart?.Invoke(m_CurrentWaveNumber);

        if (mapData == null || enemyPool == null)
        {
            throw new InvalidOperationException("EnemyBase wasn't initialized correctly.\nMake sure to provide both MapData and an enemy pool");
        }
    }
Exemple #3
0
    private void CompleteWave()
    {
        OnWaveComplete?.Invoke(m_CurrentWaveNumber);

        m_WaveTimer = m_TimeBetweenWaves;

        if (m_MapData.m_BoxymonWaves.Count > 0)
        {
            m_CurrentWave = m_MapData.m_BoxymonWaves.Dequeue();
            OnWaveStart?.Invoke(++m_CurrentWaveNumber);
        }
        else
        {
            OnAllWavesComplete?.Invoke();
        }
    }