private void PlayerHit() { if (invulnerable == false) { if (playerLives > 1) { StartCoroutine("playerInvulnerable"); } playerLives--; gunjam.chance = 30; hearts.livesDown(); if (playerLives == 0) { //highscore.saveYourScore(); //highscore.newHighScoreCheck(); //DisplayLives(); SceneManager.LoadScene("DeathScene"); Destroy(gameObject); } else if (playerLives == 1) { gunjam.chance = 60; } } // Lose 1 life }
IEnumerator PlayerHit() { // Lose 1 life playerLives--; hearts.livesDown(); if (playerLives == 0) { //DisplayLives(); Destroy(gameObject); } // Remove collider for 1 second m_Collider.enabled = false; yield return(new WaitForSeconds(1f)); m_Collider.enabled = true; }