public void OnDeath()
 {
     isDead = true;
     if (PlayerPrefs.GetFloat("Highscore") < score)
     {
         PlayerPrefs.SetFloat("Highscore", score);
     }
     deathMenu.EndMenu(score);
 }
    // Death function
    void Dead()
    {
        isDead = true;

        // To make sure the death audio only play once, when the player collide with an obstacle
        if (!alreadyPlayed)
        {
            PlayAudio(4, 0.9f);
            alreadyPlayed = true;
        }

        // Call Globals's GameOver function
        Globals.GameOver();

        // Set a high score when the score is bigger than last time
        if (PlayerPrefs.GetFloat("HighScore") < (Globals.score + Globals.bunus))
        {
            PlayerPrefs.SetFloat("HighScore", (Globals.score + Globals.bunus));
        }

        // call DeathMenu's EndMenu function
        deathMenu.EndMenu();
    }