using UnityEngine;
public class TimeCountdown : MonoBehaviour
{
/// <summary>
/// 为真,则在update 里面计算,为假,则以真实时间 的秒数进行计算。
/// </summary>
bool test = true;
public System.TimeSpan s_;
public int d, h, m, s;
public int count = 0, maxCount = 50,reduceTime = 1;
// Start is called before the first frame update
void Start()
{
if (test)
{
reduceTime = 30;
}
initTimeCountDown(new System.TimeSpan(2, 0, 10, 5));//2天0小时10分钟5秒
}
public void initTimeCountDown(System.TimeSpan t_)
{
s_ = t_;//小时最大24为1天,60分钟为1小时,60秒为1分钟
d = s_.Days;
h = s_.Hours;
m = s_.Minutes;
s = s_.Seconds;
//count = maxCount;
if (test)
{
reduceTime = 30;
}
}
void countDown()
{
if (count < maxCount)
{
count++;
}
else
{