質問編集履歴

3

code修正

2020/06/20 17:03

投稿

jo1jo2jo3
jo1jo2jo3

スコア45

test CHANGED
File without changes
test CHANGED
@@ -220,7 +220,9 @@
220
220
 
221
221
  ```ここに言語を入力
222
222
 
223
+ コード
224
+
223
- コードusing UnityEngine;
225
+ ```using UnityEngine;
224
226
 
225
227
  using UnityEngine.UI;
226
228
 

2

code修正

2020/06/20 17:03

投稿

jo1jo2jo3
jo1jo2jo3

スコア45

test CHANGED
File without changes
test CHANGED
@@ -218,11 +218,9 @@
218
218
 
219
219
 
220
220
 
221
- 2⃣ゲームセレクトプログラム
221
+ ```ここに言語を入力
222
-
223
-
224
-
222
+
225
- ```using UnityEngine;
223
+ コードusing UnityEngine;
226
224
 
227
225
  using UnityEngine.UI;
228
226
 
@@ -310,6 +308,4 @@
310
308
 
311
309
 
312
310
 
313
- コード
314
-
315
311
  ```

1

code修正

2020/06/20 17:02

投稿

jo1jo2jo3
jo1jo2jo3

スコア45

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,8 @@
1
+ ```ここに言語を入力
2
+
3
+ コード
4
+
1
- Unityのゲームプログラムについて質問です。
5
+ ```Unityのゲームプログラムについて質問です。
2
6
 
3
7
  UnityではじめるC# という本でサンプルゲームをつくっております。
4
8
 
@@ -218,100 +222,94 @@
218
222
 
219
223
 
220
224
 
221
-
225
+ ```using UnityEngine;
226
+
227
+ using UnityEngine.UI;
228
+
229
+ using System.Collections;
230
+
231
+
232
+
233
+ using UnityEngine.SceneManagement;
234
+
235
+
236
+
237
+ public class StageSelectManager : MonoBehaviour {
238
+
239
+
240
+
241
+ public GameObject[] stageButtons; //ステージ選択ボタン配列
242
+
243
+
244
+
245
+ // Use this for initialization
246
+
247
+ void Start () {
248
+
249
+ //どのステージまでクリアしているのかをロード(セーブ前なら「0」)
250
+
251
+ int clearStageNo = PlayerPrefs.GetInt ("CLEAR", 0);
252
+
253
+
254
+
255
+ //ステージボタンを有効化
256
+
257
+ for (int i = 0; i <= stageButtons.GetUpperBound (0); i++) {
258
+
259
+ bool b;
260
+
261
+
262
+
263
+ if (clearStageNo < i) {
264
+
265
+ b = false; //前ステージをクリアしていなければ無効
266
+
267
+ } else {
268
+
269
+ b = true; //前ステージをクリアしていれば有効
270
+
271
+ }
272
+
273
+
274
+
275
+ //ボタンの有効/無効を設定
276
+
277
+ stageButtons [i].GetComponent<Button> ().interactable = b;
278
+
279
+ }
280
+
281
+ }
282
+
283
+
284
+
285
+ // Update is called once per frame
286
+
287
+ void Update () {
288
+
289
+
290
+
291
+ }
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+ //ステージ選択ボタンを押した
300
+
301
+ public void PushStageSelectButton (int stageNo) {
302
+
303
+ //ゲームシーンへ
304
+
305
+ SceneManager.LoadScene ("PuzzleScene" + stageNo);
306
+
307
+ }
308
+
309
+ }
222
310
 
223
311
 
224
312
 
225
313
  コード
226
314
 
227
- ``````using UnityEngine;
228
-
229
- using UnityEngine.UI;
230
-
231
- using System.Collections;
232
-
233
-
234
-
235
- using UnityEngine.SceneManagement;
236
-
237
-
238
-
239
- public class StageSelectManager : MonoBehaviour {
240
-
241
-
242
-
243
- public GameObject[] stageButtons; //ステージ選択ボタン配列
244
-
245
-
246
-
247
- // Use this for initialization
248
-
249
- void Start () {
250
-
251
- //どのステージまでクリアしているのかをロード(セーブ前なら「0」)
252
-
253
- int clearStageNo = PlayerPrefs.GetInt ("CLEAR", 0);
254
-
255
-
256
-
257
- //ステージボタンを有効化
258
-
259
- for (int i = 0; i <= stageButtons.GetUpperBound (0); i++) {
260
-
261
- bool b;
262
-
263
-
264
-
265
- if (clearStageNo < i) {
266
-
267
- b = false; //前ステージをクリアしていなければ無効
268
-
269
- } else {
270
-
271
- b = true; //前ステージをクリアしていれば有効
272
-
273
- }
274
-
275
-
276
-
277
- //ボタンの有効/無効を設定
278
-
279
- stageButtons [i].GetComponent<Button> ().interactable = b;
280
-
281
- }
282
-
283
- }
284
-
285
-
286
-
287
- // Update is called once per frame
288
-
289
- void Update () {
290
-
291
-
292
-
293
- }
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
- //ステージ選択ボタンを押した
302
-
303
- public void PushStageSelectButton (int stageNo) {
304
-
305
- //ゲームシーンへ
306
-
307
- SceneManager.LoadScene ("PuzzleScene" + stageNo);
308
-
309
- }
310
-
311
- }
312
-
313
-
314
-
315
- コード
316
-
317
315
  ```