init
This commit is contained in:
commit
9afd57306d
323 changed files with 204673 additions and 0 deletions
55
Assets/MenuManager.cs
Normal file
55
Assets/MenuManager.cs
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue