feat: 플레이 중 포션 사용 로직 적용

This commit is contained in:
aube.lee
2025-03-01 21:46:27 +09:00
parent 67c017bbbf
commit 068cab2d8a
8 changed files with 576 additions and 25 deletions

View File

@@ -206,6 +206,27 @@ namespace TON
isRecovering = false;
}
public void UsePotion(string type)
{
switch (type)
{
case "HP":
if (currentHP < maxHP) // currentHP가 maxHP보다 작을 때만 실행
{
currentHP = Mathf.Min(currentHP + (maxHP * 0.2f), maxHP); // maxHP를 초과하지 않도록 보정
OnHPChanged?.Invoke(currentHP, maxHP);
}
break;
case "MP":
if (currentSP < maxSP) // currentSP가 maxSP보다 작을 때만 실행
{
currentSP = Mathf.Min(currentSP + (maxSP * 0.2f), maxSP); // maxSP를를 초과하지 않도록 보정
OnSPChanged?.Invoke(currentSP, maxSP);
}
break;
}
}
public void SkillAttack(string skillId)
{
SkillBase skillBase = SkillDataManager.Singleton.GetSkillInstance(skillId);

View File

@@ -68,6 +68,21 @@ namespace TON
});
}
public void UsePotion(string type)
{
switch (type)
{
case "HP":
userItem.hpPotion -= 1;
itemDataManager.UpdateHpData(userItem.hpPotion);
break;
case "MP":
userItem.mpPotion -= 1;
itemDataManager.UpdateMpData(userItem.mpPotion);
break;
}
}
public void AddGold(int amount)
{
goldAmount += amount;