teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

文法の修正

2018/06/25 00:43

投稿

退会済みユーザー
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
- public Explodable explodable;
9
+ public Explodable explodable;
11
10
 
12
- private void Update()
11
+ private void Update() {
13
- {
14
- if ( Input.GetKeyDown( KeyCode.Z ) )
12
+ if (Input.GetKeyDown(KeyCode.Z)) {
15
- {
16
- explodable.explode();
13
+ explodable.explode();
14
+ var ef = FindObjectOfType<ExplosionForce>();
15
+ ef.doExplosion(transform.position);
17
- }
16
+ }
18
- }
17
+ }
19
18
  }
20
- ```
19
+ ```
20
+ ↓バラバラにするオブジェクトの設定
21
+ ![イメージ説明](df5f8b325f3cded3ce964d366f0eb473.png)

2

文法の修正

2018/06/25 00:43

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -3,23 +3,18 @@
3
3
  しかし、Zキーを押しても反応がありません。エラーはありません。
4
4
  分かる方よろしくお願いします。
5
5
  ```c#
6
- import UIKit
6
+ using UnityEngine;
7
7
 
8
- class ViewController: UIViewController {
8
+ public class CubeController : MonoBehaviour
9
+ {
10
+ public Explodable explodable;
9
11
 
10
- @IBOutlet weak var ColorView2: UIView!
12
+ private void Update()
11
-
12
- @IBAction func changedColor(_ sender: UISegmentedControl) {
13
+ {
13
-
14
- switch sender.selectedSegmentIndex {
14
+ if ( Input.GetKeyDown( KeyCode.Z ) )
15
- case 0:
15
+ {
16
- ColorView2.backgroundColor = UIColor.blue
17
- case 1:
18
- ColorView2.backgroundColor = UIColor.red
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

誤字

2018/06/24 10:25

投稿

退会済みユーザー
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