标签:mamicode
using UnityEngine;
using System.Collections;
public class CoolTime : MonoBehaviour {
// Use this for initialization
void Start () {
}
int CoolTimes = 100;
// Update is called once per frame
void Update () {
}
void OnGUI()
{
GUILayout.Label(CoolTimes.ToString());
if (GUILayout.Button("Begin"))
{
StartCoroutine(waitForOneSecond());
}
}
public IEnumerator waitForOneSecond()
{
while (CoolTimes >= 0)
{
CoolTimes--;
yield return new WaitForSeconds(1);
}
}
}
标签:mamicode
原文地址:http://www.cnblogs.com/zhaoyier/p/3865116.html