質問編集履歴

2

誤字変更

2018/08/08 15:29

投稿

maimai19
maimai19

スコア9

title CHANGED
File without changes
body CHANGED
@@ -1,65 +1,18 @@
1
1
  画像下の「Use Collision]のチェックボックスをスクリプト上でon/off切り替えたいのですがやり方がわからないです.
2
2
 
3
- ソースコードの下にあるif文のところで切り替えたいと思っています.
3
+ ソースコードにあるif文のところで切り替えたいと思っています.
4
4
 
5
5
  ![イメージ説明](23fd18d705e2b9f77babd7cb7cdc9350.png)
6
6
  ```c#
7
- using System.Collections;
8
- using System.Collections.Generic;
9
- using UnityEngine;
10
- using UnityEngine.UI;
11
7
 
12
- public class BurgeraaGenetator : MonoBehaviour {
13
-
14
-
15
-
16
- public GameObject BurgerPrefab;
17
-
18
- GameObject director;
19
- GameObject Window;
20
- GameObject cbText;
21
-
22
-
23
- double cb= 0; //投げた個数
24
- double ouver = 80 * 10 ^ 6; //ガラス の応力[N/m^2]
25
- double omosa=122*10^-3; //バーガーの重さ[kg]
26
- double speed = 100 / 3.6; //速度[m/s]
27
- double sixyou = 5 * 10 - 3; //衝突時間[s]
28
- double uhen = 0;
29
-
30
- void Start(){
31
- this.director = GameObject.Find("GameDirector");
32
- this.cbText = GameObject.Find("CB");
33
- this.Window = GameObject.Find("Window");
34
- }
35
-
36
- void Update () {
37
-
38
-
39
- if(Input.GetMouseButtonDown(0)){
40
- GameObject Burger =Instantiate(BurgerPrefab) as GameObject;
41
-
42
- Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); //マウスで押した方向にとばす
43
- Vector3 worldDir = ray.direction;
44
- Burger.GetComponent<BurgerController>().Shoot(worldDir.normalized * 2000);
45
-
46
-
47
- cb++;
48
- uhen = (omosa * cb * speed) / (sixyou); //質量*加速度
49
- this.cbText.GetComponent<Text>().text = this.cb.ToString() + "個投げた";
50
-
51
- if(ouver<uhen){ //ガラス 割らない
8
+ if(ouver<uhen){
52
9
  GetComponent(BreakableWindow).enabled =false;
53
10
  }
54
11
  else{
55
12
  GetComponent(BreakableWindow).enabled = true;
56
13
  }
57
14
 
58
- }
59
15
 
60
- }
61
- }
62
-
63
16
  ```
64
17
 
65
18
  ![![イメージ説明](ccdc8e44c7f2ad000fe44df4ba02cb53.png)]

1

エラー画面の追加

2018/08/08 15:29

投稿

maimai19
maimai19

スコア9

title CHANGED
File without changes
body CHANGED
@@ -60,4 +60,6 @@
60
60
  }
61
61
  }
62
62
 
63
- ```
63
+ ```
64
+
65
+ ![![イメージ説明](ccdc8e44c7f2ad000fe44df4ba02cb53.png)]