質問編集履歴
3
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,28 +12,30 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
public class CubeController : MonoBehaviour
|
15
|
+
public class CubeController : MonoBehaviour {
|
16
16
|
|
17
|
-
{
|
18
|
-
|
19
|
-
|
17
|
+
public Explodable explodable;
|
20
18
|
|
21
19
|
|
22
20
|
|
23
|
-
|
21
|
+
private void Update() {
|
24
22
|
|
25
|
-
|
23
|
+
if (Input.GetKeyDown(KeyCode.Z)) {
|
26
24
|
|
27
|
-
|
25
|
+
explodable.explode();
|
28
26
|
|
29
|
-
|
27
|
+
var ef = FindObjectOfType<ExplosionForce>();
|
30
28
|
|
31
|
-
|
29
|
+
ef.doExplosion(transform.position);
|
32
30
|
|
33
|
-
|
31
|
+
}
|
34
32
|
|
35
|
-
|
33
|
+
}
|
36
34
|
|
37
35
|
}
|
38
36
|
|
39
37
|
```
|
38
|
+
|
39
|
+
↓バラバラにするオブジェクトの設定
|
40
|
+
|
41
|
+
![イメージ説明](df5f8b325f3cded3ce964d366f0eb473.png)
|
2
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,42 +8,32 @@
|
|
8
8
|
|
9
9
|
```c#
|
10
10
|
|
11
|
-
i
|
11
|
+
using UnityEngine;
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
class
|
15
|
+
public class CubeController : MonoBehaviour
|
16
|
+
|
17
|
+
{
|
18
|
+
|
19
|
+
public Explodable explodable;
|
16
20
|
|
17
21
|
|
18
22
|
|
19
|
-
|
23
|
+
private void Update()
|
20
24
|
|
25
|
+
{
|
21
26
|
|
27
|
+
if ( Input.GetKeyDown( KeyCode.Z ) )
|
22
28
|
|
23
|
-
|
29
|
+
{
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
31
|
+
explodable.explode();
|
28
|
-
|
29
|
-
case 0:
|
30
|
-
|
31
|
-
ColorView2.backgroundColor = UIColor.blue
|
32
|
-
|
33
|
-
case 1:
|
34
|
-
|
35
|
-
ColorView2.backgroundColor = UIColor.red
|
36
|
-
|
37
|
-
case 2:
|
38
|
-
|
39
|
-
ColorView2.backgroundColor = UIColor.green
|
40
|
-
|
41
|
-
default:
|
42
|
-
|
43
|
-
ColorView2.backgroundColor = UIColor.blue
|
44
32
|
|
45
33
|
}
|
46
34
|
|
47
35
|
}
|
48
36
|
|
37
|
+
}
|
38
|
+
|
49
39
|
```
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
上記のブログを参考に、Zキーを押すとバラバラになるオブジェクトを作成しました。
|
4
4
|
|
5
|
-
しかし、Zキーを押しても反応がありません。エラー。
|
5
|
+
しかし、Zキーを押しても反応がありません。エラーはありません。
|
6
6
|
|
7
|
-
|
7
|
+
分かる方よろしくお願いします。
|
8
8
|
|
9
9
|
```c#
|
10
10
|
|