Last active
August 29, 2015 14:19
-
-
Save suakig/14e925c820ae81e3e10d to your computer and use it in GitHub Desktop.
CreateNextScore
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 UnityEngine.UI; | |
using System.Collections; | |
/// <summary> | |
/// 次の目標値を決めるクラス | |
/// </summary> | |
public class CreateNextScore : MonoBehaviour { | |
public float invokeTime = 1; //何秒に一回呼ぶか | |
public MinMaxSliderValue randRange; //乱数範囲設定 | |
private ShowCountCycle score; | |
private Text nextScore; | |
void Start () { | |
score = transform.FindChild ("Score").GetComponent<ShowCountCycle>(); | |
nextScore = transform.FindChild ("NextScore").GetComponent<Text>(); | |
Run (); | |
} | |
void Run () | |
{ | |
int rand = Random.Range ((int)randRange.minValue, (int)randRange.maxValue); | |
nextScore.text = "NextScore " + rand.ToString(); | |
score.GetNext (rand); | |
Invoke ("Run", invokeTime); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment