質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -3,487 +3,3 @@
|
|
3
3
|
Textデータ.Stage0の状態からクリックでブロックを消していき、Textデータ.Stage1の形の時にOKボタンを押すとクリアとしたいです。
|
4
4
|
|
5
5
|
自分の推測として、OKボタンを押した際にStage1情報を取得し、現在の配列情報と合致していたらクリアという考え方ではないかと推測していますがどのようなスクリプトを書いたら良いでしょうか?
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
```C#:BlocksController
|
12
|
-
|
13
|
-
using System.Collections;
|
14
|
-
|
15
|
-
using System.Collections.Generic;
|
16
|
-
|
17
|
-
using UnityEngine;
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
public enum BlockType
|
22
|
-
|
23
|
-
{
|
24
|
-
|
25
|
-
DEATH,
|
26
|
-
|
27
|
-
ALIVE,
|
28
|
-
|
29
|
-
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
public class BlocksController : MonoBehaviour
|
34
|
-
|
35
|
-
{
|
36
|
-
|
37
|
-
public BlockType type;
|
38
|
-
|
39
|
-
public Sprite deathSprite;
|
40
|
-
|
41
|
-
public Sprite aliveSprite;
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
SpriteRenderer spriteRenderer;
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
StageManager stageManager;
|
50
|
-
|
51
|
-
Vector3Int intPosition;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
void Awake()
|
56
|
-
|
57
|
-
{
|
58
|
-
|
59
|
-
spriteRenderer = GetComponent<SpriteRenderer>();
|
60
|
-
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
public void Init(BlockType blockType, Vector3Int position, StageManager stageManager)
|
66
|
-
|
67
|
-
{
|
68
|
-
|
69
|
-
intPosition = position;
|
70
|
-
|
71
|
-
this.stageManager = stageManager;
|
72
|
-
|
73
|
-
SetType(type);
|
74
|
-
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
void SetType(BlockType blockType)
|
80
|
-
|
81
|
-
{
|
82
|
-
|
83
|
-
type = blockType;
|
84
|
-
|
85
|
-
SetSprite(type);
|
86
|
-
|
87
|
-
}
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
void SetSprite(BlockType type)
|
92
|
-
|
93
|
-
{
|
94
|
-
|
95
|
-
if (type == BlockType.DEATH)
|
96
|
-
|
97
|
-
{
|
98
|
-
|
99
|
-
spriteRenderer.sprite = deathSprite;
|
100
|
-
|
101
|
-
}
|
102
|
-
|
103
|
-
else if (type == BlockType.ALIVE)
|
104
|
-
|
105
|
-
{
|
106
|
-
|
107
|
-
spriteRenderer.sprite = aliveSprite;
|
108
|
-
|
109
|
-
}
|
110
|
-
|
111
|
-
}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
//クリックしたら実行
|
116
|
-
|
117
|
-
public void OnBlock()
|
118
|
-
|
119
|
-
{
|
120
|
-
|
121
|
-
ClearBlock();
|
122
|
-
|
123
|
-
stageManager.ClickedBlock(intPosition);
|
124
|
-
|
125
|
-
}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
public void ClearBlock()
|
130
|
-
|
131
|
-
{
|
132
|
-
|
133
|
-
if (type == BlockType.DEATH)
|
134
|
-
|
135
|
-
{
|
136
|
-
|
137
|
-
SetType(BlockType.ALIVE);
|
138
|
-
|
139
|
-
}
|
140
|
-
|
141
|
-
else if (type == BlockType.ALIVE)
|
142
|
-
|
143
|
-
{
|
144
|
-
|
145
|
-
SetType(BlockType.DEATH);
|
146
|
-
|
147
|
-
//Destroy(this.gameObject); //ブロックを消す
|
148
|
-
|
149
|
-
}
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
```
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
```C#:CheckButton
|
160
|
-
|
161
|
-
using System.Collections;
|
162
|
-
|
163
|
-
using System.Collections.Generic;
|
164
|
-
|
165
|
-
using UnityEngine;
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
public class CheckButton : MonoBehaviour
|
170
|
-
|
171
|
-
{
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
void Start()
|
176
|
-
|
177
|
-
{
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
}
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
void Update()
|
186
|
-
|
187
|
-
{
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
}
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
}
|
198
|
-
|
199
|
-
```
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
追記1
|
206
|
-
|
207
|
-
---
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
StageManagerにこのように記述しました。
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
```C#:StageManager
|
216
|
-
|
217
|
-
using System.Collections;
|
218
|
-
|
219
|
-
using System.Collections.Generic;
|
220
|
-
|
221
|
-
using UnityEngine;
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
public class StageManager : MonoBehaviour
|
226
|
-
|
227
|
-
{
|
228
|
-
|
229
|
-
public TextAsset stageFile1;
|
230
|
-
|
231
|
-
public TextAsset stageFile2;
|
232
|
-
|
233
|
-
BlockType[,] blockTable;
|
234
|
-
|
235
|
-
BlocksController[,] blockTableobj;
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
public BlocksController blockPrefab;
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
void Start()
|
244
|
-
|
245
|
-
{
|
246
|
-
|
247
|
-
LoadStageFromText();
|
248
|
-
|
249
|
-
DebugTable();
|
250
|
-
|
251
|
-
CreateStage();
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
// ステージのデータ
|
256
|
-
|
257
|
-
var blockTable = new BlockType[,] {
|
258
|
-
|
259
|
-
{ BlockType.DEATH, BlockType.DEATH, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
260
|
-
|
261
|
-
{ BlockType.DEATH, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
262
|
-
|
263
|
-
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
264
|
-
|
265
|
-
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.DEATH , BlockType.DEATH, BlockType.ALIVE},
|
266
|
-
|
267
|
-
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.DEATH , BlockType.DEATH, BlockType.ALIVE},
|
268
|
-
|
269
|
-
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
270
|
-
|
271
|
-
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.DEATH , BlockType.DEATH, BlockType.DEATH},
|
272
|
-
|
273
|
-
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.ALIVE , BlockType.DEATH, BlockType.DEATH},
|
274
|
-
|
275
|
-
{ BlockType.DEATH, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
276
|
-
|
277
|
-
{ BlockType.DEATH, BlockType.DEATH, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
278
|
-
|
279
|
-
};
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
// 操作されるゲームオブジェクトが持つデータ
|
284
|
-
|
285
|
-
var BlocksController = new BlocksController[,] {
|
286
|
-
|
287
|
-
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
288
|
-
|
289
|
-
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
290
|
-
|
291
|
-
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
292
|
-
|
293
|
-
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE } },
|
294
|
-
|
295
|
-
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE } },
|
296
|
-
|
297
|
-
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
298
|
-
|
299
|
-
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH } },
|
300
|
-
|
301
|
-
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH } },
|
302
|
-
|
303
|
-
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
304
|
-
|
305
|
-
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
306
|
-
|
307
|
-
};
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
}
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
void CreateStage()
|
316
|
-
|
317
|
-
{
|
318
|
-
|
319
|
-
Vector3 halfSize = default;
|
320
|
-
|
321
|
-
float blockSize = blockPrefab.GetComponent<SpriteRenderer>().bounds.size.x;
|
322
|
-
|
323
|
-
halfSize.x = blockSize * (blockTable.GetLength(0) / 2);
|
324
|
-
|
325
|
-
halfSize.y = blockSize * (blockTable.GetLength(1) / 2);
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
for (int y = 0; y < blockTable.GetLength(1); y++)
|
330
|
-
|
331
|
-
{
|
332
|
-
|
333
|
-
for (int x = 0; x < blockTable.GetLength(0); x++)
|
334
|
-
|
335
|
-
{
|
336
|
-
|
337
|
-
Vector3Int position = new Vector3Int(x, y, 0);
|
338
|
-
|
339
|
-
BlocksController block = Instantiate(blockPrefab);
|
340
|
-
|
341
|
-
block.Init(blockTable[x,y], position, this);
|
342
|
-
|
343
|
-
Vector3 setPosition = (Vector3)position * blockSize - halfSize;
|
344
|
-
|
345
|
-
setPosition.y *= (float)-1.04;
|
346
|
-
|
347
|
-
setPosition.x *= (float)-1.04;
|
348
|
-
|
349
|
-
block.transform.position = setPosition;
|
350
|
-
|
351
|
-
blockTableobj[x, y] = block;
|
352
|
-
|
353
|
-
}
|
354
|
-
|
355
|
-
}
|
356
|
-
|
357
|
-
}
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
void LoadStageFromText()
|
362
|
-
|
363
|
-
{
|
364
|
-
|
365
|
-
string[] lines = stageFile1.text.Split(new[] { '\n', '\r' }, System.StringSplitOptions.RemoveEmptyEntries);
|
366
|
-
|
367
|
-
int columns = 10;
|
368
|
-
|
369
|
-
int rows = 5;
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
blockTable = new BlockType[rows, columns];
|
374
|
-
|
375
|
-
blockTableobj = new BlocksController[rows, columns];
|
376
|
-
|
377
|
-
for (int y = 0; y < columns; y++)
|
378
|
-
|
379
|
-
{
|
380
|
-
|
381
|
-
string[] values = lines[y].Split(new[] { ',' });
|
382
|
-
|
383
|
-
for (int x = 0; x < rows; x++)
|
384
|
-
|
385
|
-
{
|
386
|
-
|
387
|
-
if (values[x] == "0")
|
388
|
-
|
389
|
-
{
|
390
|
-
|
391
|
-
blockTable[x, y] = BlockType.DEATH;
|
392
|
-
|
393
|
-
}
|
394
|
-
|
395
|
-
if (values[x] == "1")
|
396
|
-
|
397
|
-
{
|
398
|
-
|
399
|
-
blockTable[x, y] = BlockType.ALIVE;
|
400
|
-
|
401
|
-
}
|
402
|
-
|
403
|
-
}
|
404
|
-
|
405
|
-
}
|
406
|
-
|
407
|
-
}
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
public void ClickedBlock(Vector3Int center)
|
412
|
-
|
413
|
-
{
|
414
|
-
|
415
|
-
Debug.Log("ClickedBlock");
|
416
|
-
|
417
|
-
}
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
public void IsClear()
|
422
|
-
|
423
|
-
{
|
424
|
-
|
425
|
-
bool isSuccess = true;
|
426
|
-
|
427
|
-
for (int y = 0; y < blockTable.GetLength(1); y++)
|
428
|
-
|
429
|
-
{
|
430
|
-
|
431
|
-
for (int x = 0; x < blockTable.GetLength(0); x++)
|
432
|
-
|
433
|
-
{
|
434
|
-
|
435
|
-
if (blockTableobj[x, y].type != blockTable[x, y]) isSuccess = false;
|
436
|
-
|
437
|
-
}
|
438
|
-
|
439
|
-
}
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
if (isSuccess)
|
444
|
-
|
445
|
-
{
|
446
|
-
|
447
|
-
Debug.Log("正解");
|
448
|
-
|
449
|
-
}
|
450
|
-
|
451
|
-
else
|
452
|
-
|
453
|
-
{
|
454
|
-
|
455
|
-
Debug.Log("不正解");
|
456
|
-
|
457
|
-
}
|
458
|
-
|
459
|
-
}
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
void DebugTable()
|
464
|
-
|
465
|
-
{
|
466
|
-
|
467
|
-
for (int y = 0; y < 10; y++)
|
468
|
-
|
469
|
-
{
|
470
|
-
|
471
|
-
string debugText = "";
|
472
|
-
|
473
|
-
for (int x = 0; x < 5; x++)
|
474
|
-
|
475
|
-
{
|
476
|
-
|
477
|
-
debugText += blockTable[x, y] + ",";
|
478
|
-
|
479
|
-
}
|
480
|
-
|
481
|
-
Debug.Log(debugText);
|
482
|
-
|
483
|
-
}
|
484
|
-
|
485
|
-
}
|
486
|
-
|
487
|
-
}
|
488
|
-
|
489
|
-
```
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -487,21 +487,3 @@
|
|
487
487
|
}
|
488
488
|
|
489
489
|
```
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
ButtonにStageManagerをアタッチしてIsClear関数を呼び出しました
|
494
|
-
|
495
|
-
![イメージ説明](2f2b6b5a4a45e05a5296013a14676aa1.jpeg)
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
blockTableのデータとblockTableobj[x, y].typeのデータは合っている?と思われるのですがこの状態でOKを押すと正解が出てしまいます
|
500
|
-
|
501
|
-
![![イメージ説明](6f4b083aefded1ac7898c8440ee48113.jpeg)
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
この形になった際に正解にしたいのですが不正解になってしまいます
|
506
|
-
|
507
|
-
![イメージ説明](ecb781de5557f053bb920976c9cb08b2.jpeg)
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -156,6 +156,60 @@
|
|
156
156
|
|
157
157
|
|
158
158
|
|
159
|
+
```C#:CheckButton
|
160
|
+
|
161
|
+
using System.Collections;
|
162
|
+
|
163
|
+
using System.Collections.Generic;
|
164
|
+
|
165
|
+
using UnityEngine;
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
public class CheckButton : MonoBehaviour
|
170
|
+
|
171
|
+
{
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
void Start()
|
176
|
+
|
177
|
+
{
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
void Update()
|
186
|
+
|
187
|
+
{
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
追記1
|
206
|
+
|
207
|
+
---
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
StageManagerにこのように記述しました。
|
212
|
+
|
159
213
|
|
160
214
|
|
161
215
|
```C#:StageManager
|
@@ -196,6 +250,64 @@
|
|
196
250
|
|
197
251
|
CreateStage();
|
198
252
|
|
253
|
+
|
254
|
+
|
255
|
+
// ステージのデータ
|
256
|
+
|
257
|
+
var blockTable = new BlockType[,] {
|
258
|
+
|
259
|
+
{ BlockType.DEATH, BlockType.DEATH, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
260
|
+
|
261
|
+
{ BlockType.DEATH, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
262
|
+
|
263
|
+
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
264
|
+
|
265
|
+
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.DEATH , BlockType.DEATH, BlockType.ALIVE},
|
266
|
+
|
267
|
+
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.DEATH , BlockType.DEATH, BlockType.ALIVE},
|
268
|
+
|
269
|
+
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
270
|
+
|
271
|
+
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.DEATH , BlockType.DEATH, BlockType.DEATH},
|
272
|
+
|
273
|
+
{ BlockType.ALIVE, BlockType.ALIVE, BlockType.ALIVE , BlockType.DEATH, BlockType.DEATH},
|
274
|
+
|
275
|
+
{ BlockType.DEATH, BlockType.ALIVE, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
276
|
+
|
277
|
+
{ BlockType.DEATH, BlockType.DEATH, BlockType.ALIVE , BlockType.ALIVE, BlockType.ALIVE},
|
278
|
+
|
279
|
+
};
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
// 操作されるゲームオブジェクトが持つデータ
|
284
|
+
|
285
|
+
var BlocksController = new BlocksController[,] {
|
286
|
+
|
287
|
+
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
288
|
+
|
289
|
+
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
290
|
+
|
291
|
+
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
292
|
+
|
293
|
+
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE } },
|
294
|
+
|
295
|
+
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE } },
|
296
|
+
|
297
|
+
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
298
|
+
|
299
|
+
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH } },
|
300
|
+
|
301
|
+
{ new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH } },
|
302
|
+
|
303
|
+
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
304
|
+
|
305
|
+
{ new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.DEATH }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE }, new BlocksController {type = BlockType.ALIVE } },
|
306
|
+
|
307
|
+
};
|
308
|
+
|
309
|
+
|
310
|
+
|
199
311
|
}
|
200
312
|
|
201
313
|
|
@@ -230,7 +342,9 @@
|
|
230
342
|
|
231
343
|
Vector3 setPosition = (Vector3)position * blockSize - halfSize;
|
232
344
|
|
233
|
-
setPosition.y *= -1;
|
345
|
+
setPosition.y *= (float)-1.04;
|
346
|
+
|
347
|
+
setPosition.x *= (float)-1.04;
|
234
348
|
|
235
349
|
block.transform.position = setPosition;
|
236
350
|
|
@@ -300,17 +414,47 @@
|
|
300
414
|
|
301
415
|
Debug.Log("ClickedBlock");
|
302
416
|
|
303
|
-
ClearBlocks(center);
|
304
|
-
|
305
|
-
}
|
417
|
+
}
|
306
|
-
|
307
|
-
|
308
|
-
|
418
|
+
|
419
|
+
|
420
|
+
|
309
|
-
void Clear
|
421
|
+
public void IsClear()
|
310
|
-
|
422
|
+
|
311
|
-
{
|
423
|
+
{
|
424
|
+
|
312
|
-
|
425
|
+
bool isSuccess = true;
|
426
|
+
|
313
|
-
|
427
|
+
for (int y = 0; y < blockTable.GetLength(1); y++)
|
428
|
+
|
429
|
+
{
|
430
|
+
|
431
|
+
for (int x = 0; x < blockTable.GetLength(0); x++)
|
432
|
+
|
433
|
+
{
|
434
|
+
|
435
|
+
if (blockTableobj[x, y].type != blockTable[x, y]) isSuccess = false;
|
436
|
+
|
437
|
+
}
|
438
|
+
|
439
|
+
}
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
if (isSuccess)
|
444
|
+
|
445
|
+
{
|
446
|
+
|
447
|
+
Debug.Log("正解");
|
448
|
+
|
449
|
+
}
|
450
|
+
|
451
|
+
else
|
452
|
+
|
453
|
+
{
|
454
|
+
|
455
|
+
Debug.Log("不正解");
|
456
|
+
|
457
|
+
}
|
314
458
|
|
315
459
|
}
|
316
460
|
|
@@ -346,102 +490,18 @@
|
|
346
490
|
|
347
491
|
|
348
492
|
|
349
|
-
|
350
|
-
|
351
|
-
```C#:CheckButton
|
352
|
-
|
353
|
-
using System.Collections;
|
354
|
-
|
355
|
-
using System.Collections.Generic;
|
356
|
-
|
357
|
-
using UnityEngine;
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
493
|
+
ButtonにStageManagerをアタッチしてIsClear関数を呼び出しました
|
362
|
-
|
494
|
+
|
363
|
-
|
495
|
+
![イメージ説明](2f2b6b5a4a45e05a5296013a14676aa1.jpeg)
|
496
|
+
|
497
|
+
|
498
|
+
|
364
|
-
|
499
|
+
blockTableのデータとblockTableobj[x, y].typeのデータは合っている?と思われるのですがこの状態でOKを押すと正解が出てしまいます
|
365
|
-
|
366
|
-
|
500
|
+
|
367
|
-
|
501
|
+
![![イメージ説明](6f4b083aefded1ac7898c8440ee48113.jpeg)
|
368
|
-
|
369
|
-
|
502
|
+
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
503
|
+
|
374
|
-
|
375
|
-
|
376
|
-
|
504
|
+
|
377
|
-
|
505
|
+
この形になった際に正解にしたいのですが不正解になってしまいます
|
378
|
-
|
379
|
-
|
506
|
+
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
}
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
}
|
390
|
-
|
391
|
-
```
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
507
|
+
![イメージ説明](ecb781de5557f053bb920976c9cb08b2.jpeg)
|
398
|
-
|
399
|
-
1,1,1,1,1
|
400
|
-
|
401
|
-
1,1,1,1,1
|
402
|
-
|
403
|
-
1,1,1,1,1
|
404
|
-
|
405
|
-
1,1,1,1,1
|
406
|
-
|
407
|
-
1,1,1,1,1
|
408
|
-
|
409
|
-
1,1,1,1,1
|
410
|
-
|
411
|
-
1,1,1,1,1
|
412
|
-
|
413
|
-
1,1,1,1,1
|
414
|
-
|
415
|
-
1,1,1,1,1
|
416
|
-
|
417
|
-
1,1,1,1,1
|
418
|
-
|
419
|
-
```
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
```C#:Stage1
|
426
|
-
|
427
|
-
0,0,1,1,1
|
428
|
-
|
429
|
-
0,1,1,1,1
|
430
|
-
|
431
|
-
1,1,1,1,1
|
432
|
-
|
433
|
-
1,1,0,0,1
|
434
|
-
|
435
|
-
1,1,0,0,1
|
436
|
-
|
437
|
-
1,1,1,1,1
|
438
|
-
|
439
|
-
1,1,0,0,0
|
440
|
-
|
441
|
-
1,1,1,0,0
|
442
|
-
|
443
|
-
0,1,1,1,1
|
444
|
-
|
445
|
-
0,0,1,1,1
|
446
|
-
|
447
|
-
```
|