Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class timer : MonoBehaviour {
- public Text timertext;
- private float time;
- public bool pause = false;
- // Use this for initialization
- void Start () {
- time = Time.time;
- }
- // Update is called once per frame
- void Update () {
- if (pause)
- return;
- time += Time.deltaTime;
- string minutes = ((int)time / 60).ToString();
- string seconds = (time % 60).ToString("f1");
- timertext.text = minutes + ":" + seconds;
- }
- public void pausecolor()
- {
- pause = true;
- timertext.color = Color.yellow;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement