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

回答編集履歴

3

文章が変でした

2019/12/15 08:22

投稿

madone99
madone99

スコア1857

answer CHANGED
@@ -5,17 +5,21 @@
5
5
  {
6
6
  public bool grounded;
7
7
  // 省略
8
+
8
-
9
+ public bool IsGround()
10
+ {
11
+ return grounded;
12
+ }
9
13
  }
10
14
 
11
15
  public class FallingBlockController : MonoBehaviour
12
16
  {
13
17
 
14
- [SerializedField] PlayerController player;
18
+ [SerializeField] PlayerController player;
15
19
  bool isGround;
16
20
 
17
21
  public void Start() {
18
- isGround = player.grounded;
22
+ isGround = player.IsGround();
19
23
  }
20
24
 
21
25
  public void Update()

2

修正

2019/12/15 08:22

投稿

madone99
madone99

スコア1857

answer CHANGED
@@ -15,7 +15,7 @@
15
15
  bool isGround;
16
16
 
17
17
  public void Start() {
18
- grounded = player.grounded;
18
+ isGround = player.grounded;
19
19
  }
20
20
 
21
21
  public void Update()

1

変数名の修正

2019/12/15 08:15

投稿

madone99
madone99

スコア1857

answer CHANGED
@@ -12,15 +12,15 @@
12
12
  {
13
13
 
14
14
  [SerializedField] PlayerController player;
15
- bool grounded;
15
+ bool isGround;
16
16
 
17
17
  public void Start() {
18
- grounded = player.bool;
18
+ grounded = player.grounded;
19
19
  }
20
20
 
21
21
  public void Update()
22
22
  {
23
- if(grounded && crush) {
23
+ if(isGround && crush) {
24
24
  GameOver();
25
25
  }
26
26
  }