Advertisement
Guest User

Untitled

a guest
May 27th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. /// <summary>
  6. /// 次の目標値を決めるクラス
  7. /// </summary>
  8. public class CreateNextScore : MonoBehaviour {
  9.  
  10. public float invokeTime = 1; //何秒に一回呼ぶか
  11. public MinMaxSliderValue randRange; //乱数範囲設定
  12.  
  13. private ShowCountCycle score;
  14. private Text nextScore;
  15.  
  16. void Start () {
  17. score = transform.FindChild ("Score").GetComponent<ShowCountCycle>();
  18. nextScore = transform.FindChild ("NextScore").GetComponent<Text>();
  19. Run ();
  20. }
  21.  
  22. void Run ()
  23. {
  24. int rand = Random.Range ((int)randRange.minValue, (int)randRange.maxValue);
  25. nextScore.text = "NextScore " + rand.ToString();
  26. score.GetNext (rand);
  27. Invoke ("Run", invokeTime);
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement