void Death() { // Set the death flag so this function won't be called again. isDead = true; explosion.SetActive(true); stone.SetActive(false); Manager.Instance.gameOver = true; nav.goToScoreScreen(false); }
void Death() { // Set the death flag so this function won't be called again. isDead = true; // Tell the animator that the player is dead. anim.SetTrigger("Die"); // Set the audiosource to play the death clip and play it (this will stop the hurt sound from playing). playerAudio.clip = deathClip; playerAudio.Play(); // Turn off the movement and shooting scripts. playerMovement.enabled = false; Manager.Instance.gameOver = true; nav.goToScoreScreen(false); }
void Update() { guiTime = (goalTime - Time.time) + pauseTime; if (guiTime > 0) { float minutes = Mathf.Floor(guiTime / 60); float seconds = guiTime % 60; timerText = string.Format("{0:00}:{1:00}", minutes, seconds); timertextElement.text = timerText; } else { if (enemyMan.allDead()) { //go to score creen once player wins Manager.Instance.gameOver = true; nav.goToScoreScreen(true); } else { //stop enemies from spawning and tell player how many they have left once timer ends enemyMan.stopSpawn(); enemyMan2.stopSpawn(); GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy"); finishedtextElement.text = "Kill the remaining enemies to win\nEnemies left: " + enemies.Length; } guiTime = 0; } //set power up text PowerUp[] playerPUs = player.GetComponents <PowerUp>(); powerUpText.text = "Current power ups: "; foreach (PowerUp pu in playerPUs) { powerUpText.text += "<color=" + RGBToHex(pu.color) + ">" + pu.Name + "</color>\n"; } }