DEG-143-세이브-강화-병합 #46

Closed
99jamin wants to merge 12 commits from DEG-143-세이브-강화-병합 into main
2 changed files with 25 additions and 5 deletions
Showing only changes of commit 098755294b - Show all commits

View File

@ -9,7 +9,27 @@ 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()
{
//int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
Outdated
Review

전체적으로 주석들은 남긴 이유 같이 위에 적어주시면 좋을 것 같습니다

전체적으로 주석들은 남긴 이유 같이 위에 적어주시면 좋을 것 같습니다
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~300
{
float normalizedHp = hp / 300f; // 0~1 사이 값으로 조정
@ -21,15 +41,15 @@ public class DungeonPanelController : MonoBehaviour
{
StartCoroutine(WaitForOneSecond());
// out of index error 방지
if (_countHealth > _playerHealthImages.Length - 1) return false;
if (_countHealth >= visibleHeartCount) return false;
_playerHealthImages[_countHealth].color = Color.black;
_countHealth++;
return _countHealth <= _playerHealthImages.Length - 1;
return _countHealth < visibleHeartCount;
}
IEnumerator WaitForOneSecond()
{
yield return new WaitForSeconds(1.0f);
}
}
}

BIN
Assets/KSH/ReHousing.unity (Stored with Git LFS)

Binary file not shown.