質問編集履歴

1

追加Script

2019/01/24 02:38

投稿

R_1080
R_1080

スコア18

test CHANGED
File without changes
test CHANGED
@@ -12,11 +12,55 @@
12
12
 
13
13
 
14
14
 
15
+ AボタンについているScriptです。
16
+
15
17
  ```C#
16
18
 
19
+ using System.Collections;
20
+
21
+ using System.Collections.Generic;
22
+
23
+ using UnityEngine;
24
+
25
+
26
+
27
+ public class AButtonInvoke : MonoBehaviour
28
+
29
+ {
30
+
31
+ // オブジェクト指定
32
+
33
+ public GameObject AButtonControl;
34
+
35
+
36
+
37
+ public GameObject MainObject;
38
+
39
+
40
+
41
+ public GameObject AButton;
42
+
43
+
44
+
45
+ public GameObject BButton;
46
+
47
+
48
+
49
+
50
+
51
+ // ボタンをクリックした時の処理
52
+
53
+ public void OnClick()
54
+
55
+ {
56
+
57
+ StartCoroutine("AbuttonPush");
58
+
59
+ }
60
+
17
61
  // 現れる時間指定
18
62
 
19
- IEnumerator Abutton()
63
+ IEnumerator AbuttonPush()
20
64
 
21
65
  {
22
66
 
@@ -34,6 +78,166 @@
34
78
 
35
79
  }
36
80
 
81
+ yield return new WaitForSeconds(13f);
82
+
83
+ MainObject.gameObject.SetActive(true);
84
+
37
85
  ```
38
86
 
87
+
88
+
89
+
90
+
39
- 上記、作成した一部分のScriptです。
91
+ Bボタンに付けているScriptです。
92
+
93
+ ```C#
94
+
95
+ using System.Collections;
96
+
97
+ using System.Collections.Generic;
98
+
99
+ using UnityEngine;
100
+
101
+ using UnityEngine.UI;
102
+
103
+
104
+
105
+ public class BButtonControl : MonoBehaviour
106
+
107
+ {
108
+
109
+
110
+
111
+ // ボタンをクリックした時の処理
112
+
113
+ public void OnClick()
114
+
115
+ {
116
+
117
+ // ボタンを非表示にする
118
+
119
+ gameObject.SetActive(false);
120
+
121
+       TransparentCanvas.SetActive("MainObject", true);
122
+
123
+
124
+
125
+ // ボタンを表示する
126
+
127
+ TransparentCanvas.SetActive("AButton", true);
128
+
129
+ }
130
+
131
+ }
132
+
133
+ ``````
134
+
135
+ InterruptionScriptです。
136
+
137
+ ``````
138
+
139
+ C#
140
+
141
+ using System.Collections;
142
+
143
+ using System.Collections.Generic;
144
+
145
+ using UnityEngine;
146
+
147
+ using UnityEngine.UI;
148
+
149
+
150
+
151
+
152
+
153
+ public class Interruption : MonoBehaviour
154
+
155
+ {
156
+
157
+
158
+
159
+ // オブジェクト指定
160
+
161
+ public GameObject AButtonControl;
162
+
163
+
164
+
165
+ public GameObject MainObject;
166
+
167
+
168
+
169
+ public GameObject AButton;
170
+
171
+
172
+
173
+ public GameObject BButton;
174
+
175
+
176
+
177
+ // オブジェクト非表示
178
+
179
+ void Start()
180
+
181
+ {
182
+
183
+
184
+
185
+ MainObject.gameObject.SetActive(false);
186
+
187
+
188
+
189
+ }
190
+
191
+ // ボタンをクリックした時の処理
192
+
193
+ public void OnClick()
194
+
195
+ {
196
+
197
+ paused = true;
198
+
199
+ StartCoroutine("startPush");
200
+
201
+ gameObject.SetActive(false);
202
+
203
+ }
204
+
205
+
206
+
207
+ // 現れる時間指定
208
+
209
+ IEnumerator startPush()
210
+
211
+ {
212
+
213
+ yield return new WaitForSeconds(1f);
214
+
215
+ MainMenu_Scene.gameObject.SetActive(true);
216
+
217
+ // Objectを表示する
218
+
219
+     IEnumerator startPush()
220
+
221
+   {
222
+
223
+ yield return new WaitForSeconds(1f);
224
+
225
+ MainObject.gameObject.SetActive(true);
226
+
227
+
228
+
229
+      yield return new WaitForSeconds(1f);
230
+
231
+ TransparentCanvas.SetActive("AButton", true);
232
+
233
+
234
+
235
+
236
+
237
+   }
238
+
239
+ }
240
+
241
+ ```
242
+
243
+ 上記が付けている物になります。