Skip to content

Instantly share code, notes, and snippets.

@suakig
Created April 17, 2015 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suakig/1ab5845c25eae9a5eff5 to your computer and use it in GitHub Desktop.
Save suakig/1ab5845c25eae9a5eff5 to your computer and use it in GitHub Desktop.
CreateNextScore.cs
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
/// <summary>
/// 次の目標値を決めるクラス
/// </summary>
public class CreateNextScore : MonoBehaviour {
public float invokeTime = 1; //何秒に一回呼ぶか
public MinMaxSliderValue randRange; //乱数範囲設定
private Text nextScore;
void Start () {
nextScore = transform.FindChild ("NextScore").GetComponent<Text>();
Run ();
}
void Run ()
{
int rand = Random.Range ((int)randRange.minValue, (int)randRange.maxValue);
nextScore.text = "NextScore " + rand.ToString();
Invoke ("Run", invokeTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment