Пример #1
0
    //===
    IEnumerator thr_spawnRoutine()
    {
        bool startWithWave = false;

        if (isOnWave)
        {
            startWithWave = true;
        }

        Coroutine waveSpawn   = null;
        Coroutine normalSpawn = null;

        currentWaveTextMesh.text = "Wave " + currentWave.ToString();
        while (true)
        {
            if (!startWithWave)
            {
                normalSpawn = StartCoroutine(thr_normalSpawn(currentWave));
                if (waveSpawn != null)
                {
                    StopCoroutine(waveSpawn);
                }
            }
            else
            {
                WaveSetting ws = FindWaveSetting(currentWave);
                enemyList.DisplayEnemyList(ws.spawnHeroForms);
                OnClick_PlayWave();
                startWithWave = false;
            }

            while (!isOnWave)
            {
                yield return(null);
            }
            if (normalSpawn != null)
            {
                StopCoroutine(normalSpawn);
            }
            noReward = true;
            foreach (Hero delHr in heroes)
            {
                delHr.DeadWithEffect("disappear");
            }
            noReward  = false;
            waveSpawn = StartCoroutine(thr_waveSpawn(currentWave));
            while (isOnWave)
            {
                yield return(null);
            }
            UIHandler.Instance.floorBuilder.UpdateUI();
            if (passCount >= PassMaxNum)
            {
                noReward = true;
            }
            foreach (Hero delHr in heroes)
            {
                delHr.DeadWithEffect("disappear");
            }
            GameManager.Instance.SaveGame();
            wavePlayButton.gameObject.SetActive(true);
            remainCountTextMesh.gameObject.SetActive(false);
            yield return(null);
        }
    }