質問編集履歴
3
.
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
2
。
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
// Use this for initialization
|
18
18
|
void Start () {
|
19
19
|
|
20
|
-
if (Playerstatus.level ==
|
20
|
+
if (Playerstatus.level == 3) {
|
21
21
|
MAXHP = 100;
|
22
22
|
HP = 100;
|
23
23
|
}
|
1
c#
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,41 @@
|
|
1
|
-
|
1
|
+
enemystatus.csにplayerstatus.csのlevelを渡しています。
|
2
|
-
|
2
|
+
inspectorでlevelを変えればif文の処理を正常に実行できるのですが
|
3
|
-
|
3
|
+
、デフォルトではplayerstatusのlevelを指定しても
|
4
|
+
変化がありません
|
5
|
+
|
6
|
+
if文の処理を実行する際levelの数値をplayerstatusから取得するようにしたい
|
4
|
-
|
7
|
+
のですが、どうすればいいでしょうか?
|
8
|
+
|
9
|
+
|
10
|
+
using UnityEngine;
|
11
|
+
using System.Collections;
|
12
|
+
|
13
|
+
public class enemystatus : MonoBehaviour {
|
14
|
+
public int MAXHP ;
|
15
|
+
public int HP ;
|
16
|
+
public playerstatus Playerstatus;
|
17
|
+
// Use this for initialization
|
18
|
+
void Start () {
|
19
|
+
|
20
|
+
if (Playerstatus.level == 1) {
|
21
|
+
MAXHP = 100;
|
22
|
+
HP = 100;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
using UnityEngine;
|
28
|
+
using System.Collections;
|
29
|
+
|
30
|
+
public class playerstatus : MonoBehaviour {
|
31
|
+
public int level = 3;
|
32
|
+
// Use this for initialization
|
33
|
+
void Start () {
|
34
|
+
level = 3;
|
35
|
+
}
|
36
|
+
|
37
|
+
// Update is called once per frame
|
38
|
+
void Update () {
|
39
|
+
|
40
|
+
}
|
41
|
+
}
|