-
Notifications
You must be signed in to change notification settings - Fork 3
/
P2HealthController.cs
57 lines (48 loc) · 1.68 KB
/
P2HealthController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using UnityEngine;
namespace BrothersOfBattle
{
public class P2HealthController : MonoBehaviour
{
internal static HealthManager _oroHealth;
internal static HealthManager _matoHealth;
internal static HealthManager _sheoHealth;
private int _healthPool = 1;
private void Awake()
{
_oroHealth = GetComponent<HealthManager>();
_matoHealth = GameObject.Find("Mato").GetComponent<HealthManager>();
_sheoHealth = GameObject.Find("Sheo Boss(Clone)(Clone)").GetComponent<HealthManager>();
On.HealthManager.TakeDamage += HealthManagerTakeDamage;
}
private void HealthManagerTakeDamage(On.HealthManager.orig_TakeDamage orig, HealthManager self, HitInstance hit)
{
_healthPool -= hit.DamageDealt;
orig(self, hit);
}
private void Start()
{
_oroHealth.hp = 99999;
_matoHealth.hp = 99999;
_sheoHealth.hp = 99999;
int bossLevel = BossSceneController.Instance.BossLevel;
if (bossLevel > 0)
{
_healthPool = 1000 + 1000 + 1450;
}
else
{
_healthPool = 600 + 1000 + 950;
}
}
private void Update()
{
if (_healthPool <= 0)
{
_oroHealth.Die(0, AttackTypes.Nail, true);
_matoHealth.Die(0, AttackTypes.Nail, true);
_sheoHealth.Die(0, AttackTypes.Nail, true);
Destroy(this);
}
}
}
}