fix: 스테이지 입장 시 하트 소모 로직 수정 및 재충전 시간 업데이트 로직 수정

This commit is contained in:
aube.lee
2025-02-16 19:40:04 +09:00
parent be2237b7ae
commit 6f9f18628c
4 changed files with 44 additions and 33 deletions

View File

@@ -12,28 +12,14 @@ namespace TON
public int characterId;
// 현재 하트 개수
public int currentHearts;
public int maxHearts = 3;
public int heartRechargeTime = 600; // 10분
public string lastHeartTime;
// 캐릭터 생성시 하트 데이터 생성자
public HeartData(int characterId)
{
this.characterId = characterId;
currentHearts = maxHearts;
}
// 하트 소모 시 변경할 객체 생성자자
public void UseHeart()
{
if (currentHearts > 0)
{
currentHearts--;
lastHeartTime = DateTime.UtcNow.ToString(); // 마지막 사용 시간 갱신
}
else
{
Debug.Log("하트가 부족합니다!");
}
// currentHearts = maxHearts;
}
}
}