繁体   English   中英

Unity / C#秒表“如果时间已过”语句(计时器> 0)

[英]Unity/C# Stopwatch If Time Has Elapsed statement (timer > 0)

在互联网上搜索了一段时间,并发现了一些可以指示我正确方向的信息,因此我可以得到答案。 以为我将来会和别人分享:

如何在C#中为秒表编写if语句以检查时间是否已过去

public Stopwatch timer = new Stopwatch();

if(timer.Elapsed.TotalSeconds == 0) {
    // if timer hasn't started
}

要么

if(timer.Elapsed.TotalSeconds > 0) {
    // if timer has started
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM