Beispiel #1
0
        // Update is called once per frame
        void Update()
        {
            bool triggerFirstWave = healthSystem.healthAsPercentage >= firstWaveHealthPercentBorder - 0.15f &&
                                    healthSystem.healthAsPercentage <= firstWaveHealthPercentBorder;
            bool triggerSecondWave = healthSystem.healthAsPercentage >= secondWaveHealthPercentBorder - 0.15f &&
                                     healthSystem.healthAsPercentage <= secondWaveHealthPercentBorder;

            if (triggerFirstWave && !spawnedSnowmans)
            {
                spawnedSnowmans = true;
                SpawnEnemies(snowman);
            }
            else if (triggerSecondWave && !spawnedStonemans)
            {
                spawnedStonemans = true;
                SpawnEnemies(stoneman);
            }

            if (healthSystem.healthAsPercentage <= Mathf.Epsilon && !bossDefeated)
            {
                StartCoroutine(musicPlaylist.FadeOutAfterBoss(3));
                fog.SetActive(false);
                exitFence.SetActive(false);
                Destroy(snowParticles);
                bossDefeated = true;
            }
        }