コード例 #1
0
    public IEnumerator SpawnWave()
    {
        if (waveNumber != waves.Length)
        {
            WaveNum.text = "Wave: " + (waveNumber + 1);

            NS_Wave wave = waves[waveNumber];
            // Is the second enemy type null?
            if (wave.enemy2 == null && wave.enemy3 == null)
            {
                EnemiesInGame = wave.count;                      // Then proceed as normal.
            }
            else if (wave.enemy2 != null && wave.enemy3 == null) // If it is,
            {
                EnemiesInGame = wave.count + wave.count2;        // Then add to wave.count
            }
            else if (wave.enemy2 != null && wave.enemy3 != null)
            {
                EnemiesInGame = wave.count + wave.count2 + wave.count3;
            }

            for (int i = 0; i < wave.count; i++) // Normal enemy
            {
                if (EnemiesInGame > 0)           // Are the enemies left greater than 0?
                {
                    SpawnEnemy(wave.enemy);
                    yield return(new WaitForSeconds(1f / wave.enemyspawnrate));

                    if (wave.enemy2 != null)
                    {
                        SpawnEnemy(wave.enemy2);
                        yield return(new WaitForSeconds(1f / wave.enemy2spawnrate));
                    }

                    if (wave.enemy3 != null)
                    {
                        SpawnEnemy(wave.enemy3);
                        yield return(new WaitForSeconds(1f / wave.enemy3spawnrate));
                    }
                    if (EnemiesInGame <= 0) // Are the enemies left equal to or less than 0?
                    {
                        break;
                    }
                }
            }

            waveNumber++;
            NS_GameManager.Money += waveMoney;
            NS_GameManager.MoneyChanged();
        }
    }
コード例 #2
0
    public void CheckDiags()
    {
        var dialog = DialogSystem.GetComponent <MB_DialogSystem>();

        //  ⚠ WARNING! Lots of tabs ahead! Don't say you weren't warned! ⚠
        // For normal recon dialog
        if (waveNumber < waves.Length && waveNumber != 0) // Is the game not over?
        {
            if (waveNumber != 0 && dialog.IsShowingReconText == false && IsTutorialLevel == false)
            {
                NS_Wave wave = waves[waveNumber];

                if (wave.enemy.gameObject.name == "Enemy1" && !EnemyDiag1)
                {
                    if (dialog.IsShowingReconText == false)
                    {
                        StartCoroutine(dialog.ShowReconDialog("I see a weak purple looking fella in the distance! I hear they can avoid blockades!"));
                        EnemyDiag1 = true;
                    }
                }
                if (wave.enemy.gameObject.name == "Enemy2")
                {
                    if (dialog.IsShowingReconText == false && !EnemyDiag2)
                    {
                        StartCoroutine(dialog.ShowReconDialog("I see a light blue looking fella in the distance! I think they are similar to the purple guys stats wise."));
                        EnemyDiag2 = true;
                    }
                }
                if (wave.enemy.gameObject.name == "Enemy3")
                {
                    if (dialog.IsShowingReconText == false && !EnemyDiag3)
                    {
                        StartCoroutine(dialog.ShowReconDialog("I see a strong looking orange fella in the distance!"));
                        EnemyDiag3 = true;
                    }
                }
                if (wave.enemy.gameObject.name == "Enemy4")
                {
                    if (dialog.IsShowingReconText == false && !EnemyDiag4)
                    {
                        StartCoroutine(dialog.ShowReconDialog("I see a pretty fast yella fella in the distance! He sure does look agile enough to avoid mines!"));
                        EnemyDiag4 = true;
                    }
                }
            }
        }
    }
コード例 #3
0
    public int EnemiesLeft;                                         // used for converting the list count into an int, it works better and idk why lol

    public IEnumerator SpawnWave()                                  // IEnumerator for spawning a wave.
    {
        var dialog = DialogSystem.GetComponent <MB_DialogSystem>(); // Use this in your script to reference the dialog system.

        if (waveNumber != waves.Length)
        {
            WaveNum.text = "Wave: " + (waveNumber + 1) + "/" + waves.Length;
            StartCoroutine(WaveTextEvent());
            if (IsTutorialLevel == false)
            {
                StartCoroutine(dialog.ShowTutorialDialog(DialogTips[Random.Range(0, DialogTips.Length)])); // Shows a random tutorial tip.
            }
            NS_Wave wave = waves[waveNumber];
            // Is the second enemy type null?
            if (wave.enemy2 == null && wave.enemy3 == null)
            {
                EnemiesInGame = wave.count;                      // Then proceed as normal.
            }
            else if (wave.enemy2 != null && wave.enemy3 == null) // If it is,
            {
                EnemiesInGame = wave.count + wave.count2;        // Then add to wave.count
            }
            else if (wave.enemy2 != null && wave.enemy3 != null) // Conditions for third enemy
            {
                EnemiesInGame = wave.count + wave.count2 + wave.count3;
            }

            for (int i = 0; i < wave.count; i++) // Enemy Spawning
            {
                //  if (EnemiesInGame > 0) // Are the enemies left greater than 0?
                // {
                SpawnEnemy(wave.enemy);
                yield return(new WaitForSeconds(1f / wave.enemyspawnrate));

                if (wave.enemy2 != null)
                {
                    SpawnEnemy(wave.enemy2);
                    yield return(new WaitForSeconds(1f / wave.enemy2spawnrate));
                }

                if (wave.enemy3 != null)
                {
                    SpawnEnemy(wave.enemy3);
                    yield return(new WaitForSeconds(1f / wave.enemy3spawnrate));
                }
                if (EnemiesInGame <= 15)                             // Are the enemies left equal to or less than 0?
                {
                    if (EnemiesLeft <= 0)                            //checks for enemies left in game
                    {
                        EnemiesLeftOver.RemoveAll((o) => o == null); //resets list, just a safety measure
                        break;
                    }
                    //    }
                }
            }

            //if (LastWaveNumber != waveNumber)
            //{
            //    EnemyDiag1 = false;
            //    EnemyDiag2 = false;
            //    EnemyDiag3 = false;
            //    EnemyDiag4 = false;
            //    MultipleEnemiesInAWaveDialog = false;
            //}

            StartCoroutine(EndWaveChecker());
            CheckDiags();
            waveNumber++;
            NS_GameManager.Money += waveMoney;
            NS_GameManager.MoneyChanged();
        }
    }