Advertisement
Guest User

Untitled

a guest
May 6th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1.     IEnumerator waitFiveSeconds()
  2.     {
  3.         if (waitCheck == true)
  4.         {
  5.             waitCheck = false;
  6.             yield return new WaitForSeconds(5);
  7.             Debug.Log("I've waited five seconds.");
  8.             waitCheck = true;
  9.             rollCheck = true;
  10.             Debug.Log("RollCheck has finally been updated.");
  11.         }
  12.     }
  13.  
  14.     void Start()
  15.     {
  16.        
  17.     }
  18.  
  19.     void Update()
  20.     {
  21.             Debug.Log("rollCheck is: " + rollCheck.ToString());
  22.             if (Ball.gameScore > 0 && rollCheck == true)
  23.             {
  24.                     rollCheck = false;
  25.                     Debug.Log("rollCheck is now: " + rollCheck.ToString());
  26.                     int randomNum = Random.Range(0, 10);
  27.                     Debug.Log("Number " + (randomNum + 1).ToString());
  28.  
  29.                     Debug.Log("UI Text says: " + GetComponent<Text>().text);
  30.                     GetComponent<Text>().text = scoreTextList[randomNum];
  31.                     Debug.Log("UI Text says: " + GetComponent<Text>().text);
  32.  
  33.                     StartCoroutine("waitFiveSeconds");
  34.                     Ball.gameScore--;
  35.             }
  36.             Debug.Log("rollcheck is finally: " + rollCheck.ToString());
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement