-
Notifications
You must be signed in to change notification settings - Fork 0
/
roulette_clicked.cs
78 lines (73 loc) · 2.15 KB
/
roulette_clicked.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class roulette_clicked : MonoBehaviour
{
public bool meal_start = false;
public GameObject meal_button_object;
private Button meal_button;
public TextAsset textAsset;
public string data;
public bool start = false;
public GameObject roulette_size;
private int max;
public GameObject button_object;
private Button button;
public bool janken_start = false;
public GameObject janken_button_object;
private Button janken_button;
public TextMeshProUGUI targetText;
private int count;
string[] janken = new string[] { "ƒO[", "ƒ`ƒ‡ƒL", "ƒp[" };
// Start is called before the first frame update
void Start()
{
TextAsset textAsset = Resources.Load<TextAsset>("meal");
data = textAsset.text;
button = button_object.GetComponent<Button>();
button.onClick.AddListener(() =>
{
start = true;
});
janken_button = janken_button_object.GetComponent<Button>();
janken_button.onClick.AddListener(() =>
{
janken_start = true;
});
meal_button = meal_button_object.GetComponent<Button>();
meal_button.onClick.AddListener(() =>
{
meal_start = true;
});
}
// Update is called once per frame
void FixedUpdate()
{
if (start)
{
max = roulette_size.GetComponent<roulette>().max_num;
targetText.text = Random.Range(1, max+1).ToString();
count++;
}
if (janken_start)
{
targetText.text = janken[Random.Range(0, janken.Length)];
count++;
}
if (meal_start)
{
string[] arr = data.Split("\n");
targetText.text = arr[Random.Range(0, arr.Length)];
count++;
}
if (count > 30)
{
meal_start = false;
start = false;
janken_start = false;
count = 0;
}
}
}