// Update is called once per frame void Update() { // Pause all spawners if (!paused && transform.position.y < stopLine) { paused = true; transform.position = new Vector2(0, stopLine); GameObject[] objs = GameObject.FindGameObjectsWithTag("Spawner"); foreach (GameObject obj in objs) { SpawnObjects spawner = obj.GetComponent <SpawnObjects> (); if (spawner != null) { spawner.StopMovement(); } else { BossScroller boss = obj.GetComponent <BossScroller> (); if (boss != null) { boss.StopMovement(); } } } DestroyAllEnemies(); BossActivate(); } //TODO: Remove this if (paused && Input.GetKeyDown(KeyCode.G)) { BossDeactivate(); } }
public void CheckAllDeaths() { bool anyoneAlive = false; foreach (Player player in playerObjList) { if (player.deathState != DeathState.FINISHED) { anyoneAlive = true; break; } } if (!anyoneAlive) { if (easyModeOn) { foreach (Player player in playerObjList) { player.Respawn(); } } else { // Show retry modal retryPanel.enabled = true; // Pause all spawners GameObject[] objs = GameObject.FindGameObjectsWithTag("Spawner"); foreach (GameObject obj in objs) { SpawnObjects spawner = obj.GetComponent <SpawnObjects> (); if (spawner != null) { spawner.StopMovement(); } else { BossScroller boss = obj.GetComponent <BossScroller> (); if (boss != null) { boss.StopMovement(); } } } } } }