using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class Menu : MonoBehaviour
{
    public Text m_highscore;
    
    // Start is called before the first frame update
    // Update is called once per frame
    public void StartLevel1()
    {
        SceneManager.LoadScene("Level1", LoadSceneMode.Single);
    }
    
    public void StartLevel2()
    {
        SceneManager.LoadScene("Level2", LoadSceneMode.Single);
    }
    
    public void StartLevel3()
    {
        SceneManager.LoadScene("Level3", LoadSceneMode.Single);
    }
    
    public void StartLevel4()
    {
        SceneManager.LoadScene("Level4", LoadSceneMode.Single);
    }

    private void Start()
    {
        UpdateHighscore();
    }

    private void UpdateHighscore()
    {
        var highscore = PlayerPrefs.GetInt("player_highscore", 0);
        
        m_highscore.text = string.Format("Highscore: {0}", highscore);
    }
}
