質問編集履歴

3

追記3 

2015/07/06 07:37

投稿

user1041
user1041

スコア27

test CHANGED
File without changes
test CHANGED
@@ -16,12 +16,6 @@
16
16
 
17
17
 
18
18
 
19
- using UnityEngine;
20
-
21
- using System.Collections;
22
-
23
- //オーディオ再生
24
-
25
19
  public class VS : MonoBehaviour {
26
20
 
27
21
 
@@ -38,7 +32,17 @@
38
32
 
39
33
  private DeathStatus status2;
40
34
 
41
-
35
+ private DragonStatus DragonMAXHP;
36
+
37
+ private DragonStatus DragonReceivedamage;
38
+
39
+ private DeathStatus DeathReceivedamage;
40
+
41
+ private DeathStatus DeathMAXHP;
42
+
43
+ private DragonStatus DragonleftHP;
44
+
45
+ private DeathStatus DeathleftHP;
42
46
 
43
47
  public AudioClip audioclip;
44
48
 
@@ -136,4 +140,8 @@
136
140
 
137
141
  }
138
142
 
143
+
144
+
145
+
146
+
139
147
  }

2

追記2

2015/07/06 07:37

投稿

user1041
user1041

スコア27

test CHANGED
File without changes
test CHANGED
@@ -86,7 +86,7 @@
86
86
 
87
87
  }
88
88
 
89
- }
89
+
90
90
 
91
91
 
92
92
 
@@ -135,3 +135,5 @@
135
135
 
136
136
 
137
137
  }
138
+
139
+ }

1

追記

2015/07/06 05:06

投稿

user1041
user1041

スコア27

test CHANGED
File without changes
test CHANGED
@@ -10,32 +10,128 @@
10
10
 
11
11
 
12
12
 
13
-
14
-
15
- Update(){
13
+ 追記
16
14
 
17
15
 
18
16
 
19
17
 
20
18
 
21
- while (DragonMAXHP>=0 && DeathMAXHP>=0) {
19
+ using UnityEngine;
22
20
 
23
- Debug.Log (DragonMAXHP);
21
+ using System.Collections;
24
22
 
25
- if(Input.GetMouseButtonDown(0));//エラ
23
+ //ディオ再生
26
24
 
27
- DragonMAXHP -= DragonReceivedamage;
25
+ public class VS : MonoBehaviour {
28
26
 
29
- Debug.Log (DeathMAXHP);
27
+
30
28
 
29
+
30
+
31
-
31
+ public AudioSource audiosource;
32
+
33
+ public AudioSource audiosource2;
34
+
35
+
36
+
37
+ private DragonStatus status;
38
+
39
+ private DeathStatus status2;
40
+
41
+
42
+
43
+ public AudioClip audioclip;
44
+
45
+ public AudioClip audioclip2;
46
+
47
+
48
+
49
+ void Start () {
50
+
51
+ audiosource = gameObject.GetComponent<AudioSource> ();
52
+
53
+ audiosource.clip = audioclip;
54
+
55
+ audiosource.Play ();
32
56
 
33
57
 
34
58
 
35
- audio.PlayOneShot(audioclip);
36
59
 
37
- if(Input.GetMouseButtonDown(0));//エラー
38
60
 
61
+
62
+
63
+ status = GetComponent<DragonStatus> ();
64
+
65
+ status2 = GetComponent<DeathStatus> ();
66
+
67
+
68
+
69
+ int DragonMAXHP = status.HP;
70
+
71
+ int DeathMAXHP = status2.HP;
72
+
73
+
74
+
75
+ int DragonReceivedamage = status2.attack - status.defend;
76
+
77
+ int DeathReceivedamage = status.attack - status2.defend;
78
+
79
+
80
+
81
+
82
+
83
+ int DragonleftHP = DragonMAXHP -= DragonReceivedamage;
84
+
85
+ int DeathleftHP = DeathMAXHP -= DeathReceivedamage;
86
+
87
+ }
88
+
89
+ }
90
+
91
+
92
+
93
+
94
+
95
+ void Update(){
96
+
97
+
98
+
99
+ Debug.Log (DragonMAXHP);
100
+
101
+ if(Input.GetMouseButtonDown(0))
102
+
103
+ {
104
+
105
+ DragonMAXHP -= DragonReceivedamage;
106
+
107
+ Debug.Log (DeathMAXHP);
108
+
109
+ }
110
+
111
+
112
+
113
+ audio.PlayOneShot(audioclip);
114
+
115
+ if(Input.GetMouseButtonDown(0))
116
+
117
+ {
118
+
39
- DeathMAXHP -= DeathReceivedamage;
119
+ DeathMAXHP -= DeathReceivedamage;
40
120
 
41
121
  audio.PlayOneShot(audioclip2);
122
+
123
+ }
124
+
125
+
126
+
127
+ if(DragonMAXHP < 0 || DeathMAXHP < 0)
128
+
129
+ {
130
+
131
+ // DragonMAXHPまたはDeathMAXHPのどちらかが0になった時の処理
132
+
133
+ }
134
+
135
+
136
+
137
+ }