質問編集履歴
3
追記3
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,9 +7,6 @@
|
|
7
7
|
追記
|
8
8
|
|
9
9
|
|
10
|
-
using UnityEngine;
|
11
|
-
using System.Collections;
|
12
|
-
//オーディオ再生
|
13
10
|
public class VS : MonoBehaviour {
|
14
11
|
|
15
12
|
|
@@ -18,7 +15,12 @@
|
|
18
15
|
|
19
16
|
private DragonStatus status;
|
20
17
|
private DeathStatus status2;
|
21
|
-
|
18
|
+
private DragonStatus DragonMAXHP;
|
19
|
+
private DragonStatus DragonReceivedamage;
|
20
|
+
private DeathStatus DeathReceivedamage;
|
21
|
+
private DeathStatus DeathMAXHP;
|
22
|
+
private DragonStatus DragonleftHP;
|
23
|
+
private DeathStatus DeathleftHP;
|
22
24
|
public AudioClip audioclip;
|
23
25
|
public AudioClip audioclip2;
|
24
26
|
|
@@ -67,4 +69,6 @@
|
|
67
69
|
}
|
68
70
|
|
69
71
|
}
|
72
|
+
|
73
|
+
|
70
74
|
}
|
2
追記2
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,9 +42,9 @@
|
|
42
42
|
int DragonleftHP = DragonMAXHP -= DragonReceivedamage;
|
43
43
|
int DeathleftHP = DeathMAXHP -= DeathReceivedamage;
|
44
44
|
}
|
45
|
-
}
|
46
45
|
|
47
46
|
|
47
|
+
|
48
48
|
void Update(){
|
49
49
|
|
50
50
|
Debug.Log (DragonMAXHP);
|
@@ -66,4 +66,5 @@
|
|
66
66
|
// DragonMAXHPまたはDeathMAXHPのどちらかが0になった時の処理
|
67
67
|
}
|
68
68
|
|
69
|
-
}
|
69
|
+
}
|
70
|
+
}
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,18 +4,66 @@
|
|
4
4
|
処理内容・クリックを1カウントしたらDeathMAXHP -= DeathReceivedamage;が実行される というものです。
|
5
5
|
|
6
6
|
|
7
|
+
追記
|
7
8
|
|
8
|
-
Update(){
|
9
9
|
|
10
|
+
using UnityEngine;
|
11
|
+
using System.Collections;
|
12
|
+
//オーディオ再生
|
13
|
+
public class VS : MonoBehaviour {
|
14
|
+
|
15
|
+
|
16
|
+
public AudioSource audiosource;
|
17
|
+
public AudioSource audiosource2;
|
18
|
+
|
19
|
+
private DragonStatus status;
|
20
|
+
private DeathStatus status2;
|
21
|
+
|
22
|
+
public AudioClip audioclip;
|
23
|
+
public AudioClip audioclip2;
|
24
|
+
|
25
|
+
void Start () {
|
26
|
+
audiosource = gameObject.GetComponent<AudioSource> ();
|
27
|
+
audiosource.clip = audioclip;
|
28
|
+
audiosource.Play ();
|
10
29
|
|
11
|
-
while (DragonMAXHP>=0 && DeathMAXHP>=0) {
|
12
|
-
Debug.Log (DragonMAXHP);
|
13
|
-
if(Input.GetMouseButtonDown(0));//エラー
|
14
|
-
DragonMAXHP -= DragonReceivedamage;
|
15
|
-
Debug.Log (DeathMAXHP);
|
16
|
-
|
17
30
|
|
31
|
+
|
32
|
+
status = GetComponent<DragonStatus> ();
|
33
|
+
status2 = GetComponent<DeathStatus> ();
|
34
|
+
|
35
|
+
int DragonMAXHP = status.HP;
|
36
|
+
int DeathMAXHP = status2.HP;
|
37
|
+
|
38
|
+
int DragonReceivedamage = status2.attack - status.defend;
|
39
|
+
int DeathReceivedamage = status.attack - status2.defend;
|
40
|
+
|
41
|
+
|
42
|
+
int DragonleftHP = DragonMAXHP -= DragonReceivedamage;
|
43
|
+
int DeathleftHP = DeathMAXHP -= DeathReceivedamage;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
void Update(){
|
49
|
+
|
50
|
+
Debug.Log (DragonMAXHP);
|
51
|
+
if(Input.GetMouseButtonDown(0))
|
52
|
+
{
|
53
|
+
DragonMAXHP -= DragonReceivedamage;
|
54
|
+
Debug.Log (DeathMAXHP);
|
55
|
+
}
|
56
|
+
|
18
|
-
audio.PlayOneShot(audioclip);
|
57
|
+
audio.PlayOneShot(audioclip);
|
19
|
-
|
58
|
+
if(Input.GetMouseButtonDown(0))
|
59
|
+
{
|
20
|
-
DeathMAXHP -= DeathReceivedamage;
|
60
|
+
DeathMAXHP -= DeathReceivedamage;
|
21
|
-
audio.PlayOneShot(audioclip2);
|
61
|
+
audio.PlayOneShot(audioclip2);
|
62
|
+
}
|
63
|
+
|
64
|
+
if(DragonMAXHP < 0 || DeathMAXHP < 0)
|
65
|
+
{
|
66
|
+
// DragonMAXHPまたはDeathMAXHPのどちらかが0になった時の処理
|
67
|
+
}
|
68
|
+
|
69
|
+
}
|