feat: 플레이 중 포션 사용 로직 적용
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user