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

質問編集履歴

3

.

2015/09/09 05:39

投稿

user1041
user1041

スコア27

title CHANGED
File without changes
body CHANGED
File without changes

2

2015/09/09 05:39

投稿

user1041
user1041

スコア27

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 == 1) {
20
+ if (Playerstatus.level == 3) {
21
21
  MAXHP = 100;
22
22
  HP = 100;
23
23
  }

1

c#

2015/09/09 05:39

投稿

user1041
user1041

スコア27

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,41 @@
1
- たとえばAのcs HP 100を持ってるとします。 BcsにHP100を渡します
1
+ enemystatus.csplayerstatus.cslevelを渡しています
2
- インスペクターからHPの数値いじれば正常に動作するのですが
2
+ inspectorでlevel変えればif文の処理を正常に実行できるのですが
3
- これHP100もっいないということですよね。?
3
+ 、デフォルトでplayerstatusのlevel指定し
4
+ 変化がありません
5
+
6
+ if文の処理を実行する際levelの数値をplayerstatusから取得するようにしたい
4
- csに直接値を渡したいのですがどうすればいいでしょうか
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
+ }