using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class MenuManager : MonoBehaviour{ public TextMeshProUGUI text; // Start is called before the first frame update void Start(){ if (PlayerPrefs.HasKey("MaxScore")){ if (PlayerPrefs.HasKey("CurrentScore")){ if (PlayerPrefs.GetInt("CurrentScore") > PlayerPrefs.GetInt("MaxScore")){ PlayerPrefs.SetInt("MaxScore", PlayerPrefs.GetInt("CurrentScore")); } PlayerPrefs.DeleteKey("CurrentScore"); } text.text = "Max Score: " + PlayerPrefs.GetInt("MaxScore"); }else{ if (PlayerPrefs.HasKey("CurrentScore")){ PlayerPrefs.SetInt("MaxScore", PlayerPrefs.GetInt("CurrentScore")); text.text = "Max Score: " + PlayerPrefs.GetInt("MaxScore"); PlayerPrefs.DeleteKey("CurrentScore"); }else{ text.text = null; } } AudioManager.instance.Stop("InGame"); AudioManager.instance.Play("MenuTheme"); } // Update is called once per frame void Update(){ } public void Play(){ LevelLoader.Instance.LoadLevel("01"); AudioManager.instance.Play("InGame"); AudioManager.instance.Stop("MenuTheme"); } public void Quit(){ Application.Quit(); } public void OpenURL(){ Application.OpenURL("https://gof-games.itch.io/"); } public void PlaySound(string sound){ AudioManager.instance.Play(sound); } }