-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBossView.cs
More file actions
27 lines (22 loc) · 860 Bytes
/
BossView.cs
File metadata and controls
27 lines (22 loc) · 860 Bytes
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
using UnityEngine;
using UnityEngine.UI;
public class BossView : MonoBehaviour
{
[SerializeField] private Slider healthSlider;
[SerializeField] private BossLevelManager bossLevelManager;
private void Awake()
{
bossLevelManager = GetComponent<BossLevelManager>();
}
public void UpdateHealthSlider()
{
if (bossLevelManager.currentBoss == null || bossLevelManager.currentBoss.stats == null)
{
Debug.LogError("Current boss is null");
return;
}
healthSlider.maxValue = bossLevelManager.currentBoss.stats.maxHealth;
healthSlider.value = bossLevelManager.currentBoss.CurrentHealth;
Debug.Log($"Current boss is: {bossLevelManager.currentBoss.name} and his max health is {bossLevelManager.currentBoss.stats.maxHealth}");
}
}