feat: 인게임 플레이 시간 노출하도록 조건 추가

This commit is contained in:
aube.lee
2025-02-26 21:31:36 +09:00
parent c0f4ace138
commit 4c480241ab
4 changed files with 399 additions and 20 deletions

View File

@@ -14,10 +14,18 @@ namespace TON
public Image hpBar;
public Image spBar;
public TextMeshProUGUI stageText;
public TextMeshProUGUI monsterHp;
public Image monsterHpBar;
public Image monsterImage;
public TextMeshProUGUI waveText;
public TextMeshProUGUI playTimeText;
public TextMeshProUGUI scoreText;
// 플레이 시간 노출하게 하는 변수
private int lastMinutes = -1;
private int lastSeconds = -1;
private string cachedTimeString = "00:00";
// public TextMeshProUGUI monsterHp;
// public Image monsterHpBar;
// public Image monsterImage;
private string playerType;
@@ -49,6 +57,29 @@ namespace TON
}
}
private void Update()
{
UpdatePlayTimeDisplay();
}
private void UpdatePlayTimeDisplay()
{
float playTime = StageManager.Singleton.PlayTime;
int minutes = Mathf.FloorToInt(playTime / 60f);
int seconds = Mathf.FloorToInt(playTime % 60f);
// 시간이 변경된 경우에만 문자열 생성
if (minutes != lastMinutes || seconds != lastSeconds)
{
lastMinutes = minutes;
lastSeconds = seconds;
cachedTimeString = $"time {minutes:00}:{seconds:00}";
playTimeText.text = cachedTimeString;
}
}
private void UpdateHPBar(float current, float max)
{
hpBar.fillAmount = current / max;