博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
显示当前分与历史最高分数
阅读量:7000 次
发布时间:2019-06-27

本文共 909 字,大约阅读时间需要 3 分钟。

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
(); //nowScore = GetComponent
(); } 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); }}

 

转载于:https://www.cnblogs.com/fuperfun/p/5360903.html

你可能感兴趣的文章
美丽的数学家:如果您讨厌数学,这些其实都是人生故事
查看>>
Kettle 中转换(transformation)的执行过程
查看>>
读书笔记-互联网思维阅读10其中一本书《自由》
查看>>
Spark入门实战系列--5.Hive(上)--Hive介绍及部署
查看>>
tomcat设置web根目录
查看>>
CF 444B(DZY Loves FFT-时间复杂度)
查看>>
OCP-1Z0-051-名称解析-文章12称号
查看>>
UVALive 4225 Prime Bases 贪心
查看>>
Oracle B-tree、位图、全文索引三大索引性能比较及优缺点汇总
查看>>
[.net 面向对象程序设计进阶] (20) 反射(Reflection)(上)利用反射技术实现动态编程...
查看>>
【转】java中float与byte[]的互转 -- 不错
查看>>
[Ogre][地形][原创]基于OgreTerrain的地形实现
查看>>
shell登录模式及其相应配置文件(转)
查看>>
Puppet常识梳理
查看>>
web.config配置文件中的configSource属性
查看>>
发现一个国内牛逼的maven仓库,速度真的太快了
查看>>
Snmp配置
查看>>
使用java实现CNN的实战
查看>>
大白话系列之C#委托与事件讲解(二)
查看>>
linux下使用 du查看某个文件或目录占用磁盘空间的大小
查看>>