diff --git a/Assets/KSH/DungeonPanelController.cs b/Assets/KSH/DungeonPanelController.cs index 3a2fd7e5..684b3e7a 100644 --- a/Assets/KSH/DungeonPanelController.cs +++ b/Assets/KSH/DungeonPanelController.cs @@ -9,30 +9,10 @@ public class DungeonPanelController : MonoBehaviour [SerializeField] private Slider _bossHealthBar; // 0~1 value [SerializeField] private Image[] _playerHealthImages; // color 값 white / black 로 조정 private int _countHealth = 0; - private int visibleHeartCount = 3; // 강화 레벨로 설정됨 - - void Start() + public void SetBossHealthBar(float hp) // hp: 0~300 { - //int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3 - int level = 2; - - visibleHeartCount = 3 + (level - 1); // level 1=3개, 2=4개, 3=5개 - - for (int i = 0; i < _playerHealthImages.Length; i++) - { - var color = _playerHealthImages[i].color; - color.a = (i < visibleHeartCount) ? 1f : 0f; - color = (i < visibleHeartCount) ? Color.white : new Color(1,1,1,0); - _playerHealthImages[i].color = color; - } - - _countHealth = 0; - } - - public void SetBossHealthBar(float hp) // hp: 0~100 - { - float normalizedHp = hp / 100f; // 0~1 사이 값으로 조정 + float normalizedHp = hp / 300f; // 0~1 사이 값으로 조정 _bossHealthBar.value = normalizedHp; } @@ -41,11 +21,11 @@ public class DungeonPanelController : MonoBehaviour { StartCoroutine(WaitForOneSecond()); // out of index error 방지 - if (_countHealth >= visibleHeartCount) return false; + if (_countHealth > _playerHealthImages.Length - 1) return false; _playerHealthImages[_countHealth].color = Color.black; _countHealth++; - return _countHealth < visibleHeartCount; + return _countHealth <= _playerHealthImages.Length - 1; } IEnumerator WaitForOneSecond() diff --git a/Assets/KSH/ReHousing.unity b/Assets/KSH/ReHousing.unity index d27eb51e..eb32bdf3 100644 --- a/Assets/KSH/ReHousing.unity +++ b/Assets/KSH/ReHousing.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3640ccb749b85dddd7e0d050698ae9585434dc23bc81be7ba0f6d3e999c30faa -size 45878 +oid sha256:8807affa9b2db75e9fd8568f3c15d629e1ba75392574134de08d6e970296acc3 +size 43883