Ejemplo n.º 1
0
    private void Reset(params object[] parameters)
    {
        List <PLESpawn> currentWaveSpawners = WorkingLevelData.GetPLESpawnsFromWave(CurrentWaveIndex);

        for (int i = 0; i < currentWaveSpawners.Count; i++)
        {
            PLESpawn spawn = currentWaveSpawners[i];
            spawn.SetOnCriticalEnemiesDead(null);
        }
        FindObjectsOfType <EnemyBase>().ToList().ForEach(enemy => { enemy.OnDeath(); });
        CurrentWaveIndex  = 0;
        infiniteWaveIndex = 0;
        hasCycledLevel    = false;
    }
Ejemplo n.º 2
0
    private void CallWave(int waveIndex)
    {
        CurrentWaveIndex = waveIndex;
        editorInstance.EnableCurrentWaveSpawnParents(waveIndex);
        List <PLESpawn> currentWaveSpawners = WorkingLevelData.GetPLESpawnsFromWave(waveIndex);

        for (int i = 0; i < currentWaveSpawners.Count; i++)
        {
            PLESpawn spawn = currentWaveSpawners[i];
            spawn.SetOnCriticalEnemiesDead(OnCriticalSpawnsInSpawnerDead);
            spawn.StartSpawning();
        }
        EventSystem.Instance.TriggerEvent(Strings.Events.PLE_CALL_WAVE, waveIndex);
        EventSystem.Instance.TriggerEvent(Strings.Events.WAVE_COMPLETE, infiniteWaveIndex);
    }
Ejemplo n.º 3
0
    private void OnCriticalSpawnsInSpawnerDead()
    {
        //check if all spawners in given wave are marked as completed
        List <PLESpawn> currentWaveSpawners = WorkingLevelData.GetPLESpawnsFromWave(CurrentWaveIndex);
        bool            lastWaveIsComplete  = true;

        if (CurrentWaveIndex > 0 || (CurrentWaveIndex == 0 && InfiniteWavesEnabled && hasCycledLevel))
        {
            int lastWaveIndex = CurrentWaveIndex - 1;
            if (lastWaveIndex < 0)
            {
                lastWaveIndex = MaxWaveIndex;
            }
            List <PLESpawn> lastWaveSpawners = WorkingLevelData.GetPLESpawnsFromWave(lastWaveIndex);
            lastWaveIsComplete = lastWaveSpawners.All(spawner => { return(spawner.AllEnemiesDead); });
        }
        bool currentWaveMinEnemiesAreDead = currentWaveSpawners.All(spawner => { return(spawner.MinEnemiesDead); });

        if (lastWaveIsComplete && currentWaveMinEnemiesAreDead)
        {
            if (CurrentWaveIndex >= WorkingLevelData.WaveCount - 1 && !InfiniteWavesEnabled)
            {
                EventSystem.Instance.TriggerEvent(
                    Strings.Events.LEVEL_COMPLETED, SceneTracker.CurrentSceneName,
                    ScoreManager.Instance.GetScore(), ModManager.leftArmOnLoad.ToString(),
                    ModManager.rightArmOnLoad.ToString());
            }
            else if (CurrentWaveIndex >= WorkingLevelData.WaveCount - 1 && InfiniteWavesEnabled)
            {
                hasCycledLevel = true;
                infiniteWaveIndex++;
                CallWave(0);
            }
            else
            {
                CallNextWave();
            }
        }
    }
Ejemplo n.º 4
0
 private List <PLESpawn> GetWavePLESpawns(int waveIndex)
 {
     return(WorkingLevelData.GetPLESpawnsFromWave(waveIndex));
 }