当前位置:网站首页>Unity writes a timer tool to start timing from the whole point. The format is: 00:00:00
Unity writes a timer tool to start timing from the whole point. The format is: 00:00:00
2022-07-06 20:13:00 【LiPing122335】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class jishi : MonoBehaviour {
private float timer = 0f;
private int h = 0;
private int m = 0;
private int s = 0;
private string timeStr = string.Empty;
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);
}
}
边栏推荐
- [cloud lesson] EI lesson 47 Mrs offline data analysis - processing OBS data through Flink
- Oceanbase Community Edition OBD mode deployment mode stand-alone installation
- In simple terms, interview surprise Edition
- Poj1149 pigs [maximum flow]
- AsyncHandler
- Wonderful coding [hexadecimal conversion]
- 句号压缩过滤器
- Selenium advanced operations
- Wechat applet common collection
- Node.js: express + MySQL实现注册登录,身份认证
猜你喜欢
Anaconda安裝後Jupyter launch 沒反應&網頁打開運行沒執行
学习打卡web
Social recruitment interview experience, 2022 latest Android high-frequency selected interview questions sharing
Tencent T3 Daniel will teach you hand-in-hand, the internal information of the factory
After solving 2961 user feedback, I made such a change
案例 ①|主机安全建设:3个层级,11大能力的最佳实践
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
Enumeration gets values based on parameters
夏志刚介绍
【GET-4】
随机推荐
Alibaba data source Druid visual monitoring configuration
语音识别(ASR)论文优选:全球最大的中英混合开源数据TALCS: An Open-Source Mandarin-English Code-Switching Corpus and a Speech
Poj3617 best cow line
POJ 3207 Ikki' s Story IV – Panda' s Trick (2-SAT)
BUUCTF---Reverse---easyre
腾讯T2大牛亲自讲解,跳槽薪资翻倍
颜色(color)转换为三刺激值(r/g/b)(干股)
腾讯字节阿里小米京东大厂Offer拿到手软,老师讲的真棒
Social recruitment interview experience, 2022 latest Android high-frequency selected interview questions sharing
POJ3617 Best Cow Line 馋
It's enough to read this article to analyze the principle in depth
[network planning] Chapter 3 data link layer (4) LAN, Ethernet, WLAN, VLAN
范式的数据库具体解释
js实现力扣71题简化路径
【计网】第三章 数据链路层(3)信道划分介质访问控制
After solving 2961 user feedback, I made such a change
How to handle the timeout of golang
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
BUUCTF---Reverse---easyre
Vscode debug run fluent message: there is no extension for debugging yaml. Should we find yaml extensions in the market?