質問編集履歴
2
誤字変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,65 +1,18 @@
|
|
1
1
|
画像下の「Use Collision]のチェックボックスをスクリプト上でon/off切り替えたいのですがやり方がわからないです.
|
2
2
|
|
3
|
-
ソースコード
|
3
|
+
ソースコードにあるif文のところで切り替えたいと思っています.
|
4
4
|
|
5
5
|

|
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
|
]
|
1
エラー画面の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -60,4 +60,6 @@
|
|
60
60
|
}
|
61
61
|
}
|
62
62
|
|
63
|
-
```
|
63
|
+
```
|
64
|
+
|
65
|
+
]
|