private void EndGame()
    {
        gameOver.gameObject.SetActive(false);
        int newScore = GameModes.GameMode.Score;
        int topScore = GameModes.LoadScore();

        container.SetActive(true);
        if (newScore > topScore)
        {
            Text score = modes.First(m =>
                                     m.mode == GameModes.GameMode.GetType()).score;
            score.text = newScore.ToString();
            GameModes.SaveScore(newScore);
        }

        GameModes.GameMode?.EndGame();
    }