// Update is called once per frame void Update() { slider.value = 1 - Time.timeSinceLevelLoad / levelSeconds; if (Time.timeSinceLevelLoad >= levelSeconds && !isEndOfLevel) { if (!spawnersDeactivated) { Spawner[] spawnerArray = GameObject.FindObjectsOfType <Spawner> (); foreach (Spawner spawner in spawnerArray) { spawner.spawnerActive = false; } spawnersDeactivated = true; } if (!defenderSpawner.AnyAttackersLeft()) { isEndOfLevel = true; DestroyAllTagged(); audioSource.Play(); winText.SetActive(true); Invoke("LoadNextLevel", audioSource.clip.length); } } }