简单的协程计时器

废话不说,上代码
	public Text _timeText;
	public int _gameTime = 10;

	void Start () {
		StartCoroutine ("_timeCountDown");
	}

	public IEnumerator _timeCountDown(){
			for (int i = _gameTime; i >= 0; i--) {
			yield return new WaitForSeconds (1f);
			_timeText.text = "Time " + i/60 +" : "+ i%60 ;
	    }
	}


你可能感兴趣的:(u3d)