Created
January 2, 2015 07:09
-
-
Save kazuooooo/4efab54947d93bf2ff97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TimerGUIText : MonoBehaviour { | |
public float timer; | |
// Update is called once per frame | |
void Update () { | |
timer -= Time.deltaTime; | |
//小数点以下切り捨て(直接切り捨てるとうまくいかないので一旦表示用の別のfloat変数を用意) | |
float timerText = Mathf.Floor (timer); | |
guiText.text = "Time : " + timerText; | |
if (0.99f >= timer) { | |
//タイマーが終わったときの処理 | |
guiText.text = "TIMEUP"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment