Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class CountDown : MonoBehaviour {
  6. float timer = 3;
  7. string getReady = "3";
  8. bool isReady = true;
  9.  
  10.  
  11.  
  12. // Use this for initialization
  13. void Start ()
  14. {
  15. StartCoroutine (getReady);
  16. }
  17.  
  18. // Update is called once per frame
  19. void Update ()
  20. {
  21. timer-=Time.deltaTime;
  22. }
  23.  
  24. IEnumerator getReady()
  25. {
  26. isReady = true;
  27.  
  28. getReady = "3";
  29. yield return new WaitForSeconds(0.5f);
  30.  
  31. getReady = "2";
  32. yield return new WaitForSeconds(0.5f);
  33.  
  34. getReady = "1";
  35. yield return new WaitForSeconds(0.5f);
  36.  
  37. getReady = "GO";
  38. yield return new WaitForSeconds(0.5f);
  39.  
  40. getReady = "";
  41. isReady = false;
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement