00:00:00计时器
来源:互联网 发布:如何彻底删除mac程序 编辑:程序博客网 时间:2024/04/29 08:54
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewTime: MonoBehaviour
{
private float timer = 0f;
private int h = 0;
private int m = 0;
private int s = 0;
private string timeStr = string.Empty;
// Update is called once per frame
void Update()
{
timer += Time.deltaTime;
if (timer >= 1f)
{
s++;
timer = 0;
}
if (s >= 60)
{
m++;
s = 0;
}
if (m >= 60)
{
h++;
m = 0;
}
if (h >= 99)
{
h = 0;
}
}
void OnGUI()
{
timeStr = string.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);
GUI.Label(new Rect(10, 10, 100, 200), timeStr);
}
}
using System.Collections.Generic;
using UnityEngine;
public class NewTime: MonoBehaviour
{
private float timer = 0f;
private int h = 0;
private int m = 0;
private int s = 0;
private string timeStr = string.Empty;
// Update is called once per frame
void Update()
{
timer += Time.deltaTime;
if (timer >= 1f)
{
s++;
timer = 0;
}
if (s >= 60)
{
m++;
s = 0;
}
if (m >= 60)
{
h++;
m = 0;
}
if (h >= 99)
{
h = 0;
}
}
void OnGUI()
{
timeStr = string.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);
GUI.Label(new Rect(10, 10, 100, 200), timeStr);
}
}
阅读全文
0 0
- 00:00:00计时器
- 00:00:00计时器
- Android 倒计时器 00:00:00格式
- 基于单片机STC89C52RC 00~60秒 计时器设计
- 顺计时器,将整数转换成分:秒(00:00)形式的时间格式字符串
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 支持向量机通俗导论(理解SVM的三层境界)
- CAB文件制作方法,OCX、DLL打包为CAB操作记录
- MySQL Workbench there is no connection to the mySQL Server
- Android OpenGL构建简单物体
- 简单 12 步理解 Python 装饰器
- 00:00:00计时器
- thinkphp5 连接Sql Service出现could not find driver的解决办法
- 2017/7/31 在线赛
- scikit-learn 实战之非监督学习 3
- git服务器搭建教程
- [安全]找回密码安全漏洞
- Spring定时任务执行一段时间后不运行了
- php+mysql实现数据分批插入
- Maven聚合模块与继承和Maven的生命周期配置