This commit is contained in:
Gerard Gascón 2025-04-24 14:20:42 +02:00
commit 9afd57306d
323 changed files with 204673 additions and 0 deletions

55
Assets/MenuManager.cs Normal file
View file

@ -0,0 +1,55 @@
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);
}
}