Skip to content

Commit

Permalink
이벤트에서 플레이어 Hp 변경 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
miniron-v committed Aug 21, 2024
1 parent 26c042b commit 85b4aa7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Assets/02. Scripts/Story/Managers/DialogueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,16 @@ private IEnumerator ProcessEvent(EventData loadedEvent)
// 전투를 시작한다.
yield return StartCoroutine(StartBattle(enemies, rewardCardList));
}

// 플레이어 체력을 변경한다.
if (dataCSV[i]["Hp"].ToString() is not emptyString)
{
// 이름들을 배열로 받아온다.
int hp = int.Parse(dataCSV[i]["Hp"].ToString());

// hp를 변경한다.
ChangePlayerHp(hp);
}
}

// 이벤트가 종료되지 않고 endIndex를 벗어난 경우 에러를 띄운다.
Expand Down Expand Up @@ -556,6 +566,23 @@ private void EquipCard(string equipCard)
notification.ShowGetCardMessage(equipCard);
}

private void ChangePlayerHp(int hp)
{
// 회복이라면
if(hp >= 0)
{
// Increase 호출
Player.Instance.IncreaseHP(hp);
// 초록 이펙트
}
else
{
// Decrease 호출
Player.Instance.DecreaseHP(hp);
// 빨강 이펙트
}
}

// 전투를 시작하고, 끝날 때까지 기다린다.
private IEnumerator StartBattle(string[] enemies, string rewardCardList)
{
Expand Down

0 comments on commit 85b4aa7

Please sign in to comment.