using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GameOver : MonoBehaviour
{
public static GameOver _instance;
public Text bestScore;
public Text nowScoreText;
void Awake()
{
_instance = this;
this.gameObject.SetActive(false);
}
void Start()
{
//bestScore = GetComponent<Text>();
//nowScore = GetComponent<Text>();
}
public void Show(float nowScore)
{
//这是设定一个存储float类型的数据的位置
float histotyHighScore = PlayerPrefs.GetFloat("historyHighScore", 0);
if (nowScore>histotyHighScore)
{
//将上面的位置的数据进行替换
PlayerPrefs.SetFloat("historyHighScore",nowScore);
}
bestScore.text = "" + histotyHighScore;
nowScoreText.text = "" + nowScore;
this.gameObject.SetActive(true);
}
}