Skip to content

Instantly share code, notes, and snippets.

@suakig
Last active August 29, 2015 14:19
Show Gist options
  • Save suakig/14e925c820ae81e3e10d to your computer and use it in GitHub Desktop.
Save suakig/14e925c820ae81e3e10d to your computer and use it in GitHub Desktop.
CreateNextScore
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