2016年11月14日 星期一
10/14 時鐘和計時器1
=====================================
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Globalization;
public class a MonoBehaviour
{
public Text mytext;
public Text mytxt;
private float myTime = 0f;
private bool isFinish = false;
Use this for initialization
void Start()
{
myTime = float.Parse(mytext.text, CultureInfo.InvariantCulture.NumberFormat);
}
Update is called once per frame
void Update()
{
if (myTime 0f)
{
myTime -= Time.deltaTime;
int myNumber = (int)myTime;
mytext.text = myNumber.ToString();
}
else
{
if (!isFinish)
{
print(time out);
mytext.text = 0;
isFinish = true;
}
}
mytxt.text = System.DateTime.Now.ToString();
}
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言