質問編集履歴
3
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,16 +5,17 @@
|
|
5
5
|
```c#
|
6
6
|
using UnityEngine;
|
7
7
|
|
8
|
-
public class CubeController : MonoBehaviour
|
8
|
+
public class CubeController : MonoBehaviour {
|
9
|
-
{
|
10
|
-
|
9
|
+
public Explodable explodable;
|
11
10
|
|
12
|
-
|
11
|
+
private void Update() {
|
13
|
-
{
|
14
|
-
|
12
|
+
if (Input.GetKeyDown(KeyCode.Z)) {
|
15
|
-
{
|
16
|
-
|
13
|
+
explodable.explode();
|
14
|
+
var ef = FindObjectOfType<ExplosionForce>();
|
15
|
+
ef.doExplosion(transform.position);
|
17
|
-
|
16
|
+
}
|
18
|
-
|
17
|
+
}
|
19
18
|
}
|
20
|
-
```
|
19
|
+
```
|
20
|
+
↓バラバラにするオブジェクトの設定
|
21
|
+

|
2
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,23 +3,18 @@
|
|
3
3
|
しかし、Zキーを押しても反応がありません。エラーはありません。
|
4
4
|
分かる方よろしくお願いします。
|
5
5
|
```c#
|
6
|
-
|
6
|
+
using UnityEngine;
|
7
7
|
|
8
|
-
class
|
8
|
+
public class CubeController : MonoBehaviour
|
9
|
+
{
|
10
|
+
public Explodable explodable;
|
9
11
|
|
10
|
-
|
12
|
+
private void Update()
|
11
|
-
|
12
|
-
|
13
|
+
{
|
13
|
-
|
14
|
-
|
14
|
+
if ( Input.GetKeyDown( KeyCode.Z ) )
|
15
|
-
|
15
|
+
{
|
16
|
-
ColorView2.backgroundColor = UIColor.blue
|
17
|
-
case 1:
|
18
|
-
|
16
|
+
explodable.explode();
|
19
|
-
case 2:
|
20
|
-
ColorView2.backgroundColor = UIColor.green
|
21
|
-
default:
|
22
|
-
ColorView2.backgroundColor = UIColor.blue
|
23
17
|
}
|
24
18
|
}
|
19
|
+
}
|
25
20
|
```
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
http://baba-s.hatenablog.com/entry/2017/12/31/130300
|
2
2
|
上記のブログを参考に、Zキーを押すとバラバラになるオブジェクトを作成しました。
|
3
|
-
しかし、Zキーを押しても反応がありません。エラー。
|
3
|
+
しかし、Zキーを押しても反応がありません。エラーはありません。
|
4
|
-
|
4
|
+
分かる方よろしくお願いします。
|
5
5
|
```c#
|
6
6
|
import UIKit
|
7
7
|
|