[英]Unity/C# Stopwatch If Time Has Elapsed statement (timer > 0)
Searched the interwebs for a while and got something that pointed me in the right direction so I could get the answer. 在互联网上搜索了一段时间,并发现了一些可以指示我正确方向的信息,因此我可以得到答案。 Thought I'd share it for somebody in the future: 以为我将来会和别人分享:
How to write an if statement in C# for a Stopwatch to check if time as elapsed 如何在C#中为秒表编写if语句以检查时间是否已过去
public Stopwatch timer = new Stopwatch();
if(timer.Elapsed.TotalSeconds == 0) {
// if timer hasn't started
}
or 要么
if(timer.Elapsed.TotalSeconds > 0) {
// if timer has started
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.