コード例 #1
0
    IEnumerator EndlessSpawnWave()
    {
        UpgradeManager.sellTowerBool = false;
        Wave wave = waves[waveIndex];

        Debug.Log("Wave Spawning");
        inWave = true;
        if (GameManager.instance.waveCount % 5 == 0)
        {
            GameManager.instance.pumpkinHealth  += 5;
            GameManager.instance.ghostHealth    += 5;
            GameManager.instance.skeletonHealth += 5;
            GameManager.instance.batHealth      += 5;
            GameManager.instance.zombieHealth   += 5;
            GameManager.instance.bossHealth     += 5;
        }
        foreach (GameObject e in wave.enemy)
        {
            SpawnEnemy(e);
            GameManager.instance.enemyCount++;
            yield return(new WaitForSeconds(1f * wave.spawnRate));
        }
        inWave = false;
        AnalyticsManager.CoinsGained();
        GameManager.instance.Spawn = false;
        GameAnalytics.NewProgressionEvent(GAProgressionStatus.Complete, "Wave " + GameManager.instance.waveCount.ToString());
        waveIndex++;
        UpgradeManager.sellTowerBool       = true;
        GameManager.instance.sendCoinsData = true;

        if (waveIndex > 34)
        {
            waveIndex = 10;
        }
    }
コード例 #2
0
    [SerializeField] AudioSource startSource; //Set this source from start button canvas if disconnected

    private void Update()
    {
        if (!GameManager.instance.Spawn && GameManager.instance.enemyCount <= 0) //Checks if the wave is finished spawning and if all enemies are dead
        {
            ButtonManager.instance.EnableButton();                               //Enables button if passes the if check
            if (GameManager.instance.sendCoinsData)
            {
                AnalyticsManager.CoinsGained();
                GameManager.instance.sendCoinsData = false;
            }
        }
    }