public void makeGameOver(bool win) { MapScript map = GameObject.FindGameObjectWithTag("Map").GetComponent("MapScript") as MapScript; map.changeToBlack(); AmmoSpawnScript ammo = GameObject.FindGameObjectWithTag("AmmoScript").GetComponent("AmmoSpawnScript") as AmmoSpawnScript; AmmoSpawnScript.gameOver = true; gameOver = true; replayButton.SetActive(true); if (win) { GameOverText.text = "You Win!"; SubText.text = "Good boy."; } else { GameOverText.text = "You lose!"; SubText.text = "Bark Again Next Time..."; } }