웨이브 카운트 다운 중 플레이 타임 증가하지 않도록 수정

This commit is contained in:
Mingu Kim
2025-03-12 18:33:53 +09:00
parent 1c05f7a32c
commit 29ccef4231
2 changed files with 28 additions and 15 deletions

View File

@@ -25,6 +25,8 @@ namespace TON
private float nextWaveDelay = 5f; // 다음 웨이브 시작 전 대기 시간
private bool isWaitingForNextWave = false;
public bool isTimerRunning = false; // 타이머 실행 여부
[System.Serializable]
public class WaveData
{
@@ -58,6 +60,7 @@ namespace TON
private IEnumerator StartGameWithDelay()
{
isTimerRunning = true; // 타이머 시작
// 초기 카운트다운 표시
float timer = initialDelay;
while (timer > 0)
@@ -75,6 +78,7 @@ namespace TON
waveCounter.text = null;
}
isTimerRunning = false; // 타이머 종료
gameStarted = true;
StartNextWave();
}
@@ -284,6 +288,8 @@ namespace TON
private IEnumerator StartNextWaveWithDelay()
{
isTimerRunning = true; // 타이머 시작
// 웨이브가 10이면 (즉, 10스테이지가 끝났으면) 또는 웨이브가 11이면 게임 종료 UI를 바로 보여줌
if (currentWave == 10 || currentWave == 11 || GameObject.Find("TON.Player").GetComponentInChildren<CharacterBase>() == null)
{
@@ -302,6 +308,7 @@ namespace TON
yield return null;
}
isTimerRunning = false; // 타이머 종료
waveCounter.text = null;
isWaitingForNextWave = false;

View File

@@ -22,6 +22,7 @@ namespace TON
private int lastMinutes = -1;
private int lastSeconds = -1;
private string cachedTimeString = "00:00";
private MonsterSpawner _monsterSpawner;
private string playerType;
@@ -39,6 +40,7 @@ namespace TON
character.OnSPChanged += UpdateSPBar;
}
_monsterSpawner = GameObject.FindObjectOfType<MonsterSpawner>();
// UI가 활성화될 때 저장된 값들로 업데이트
RefreshUI();
}
@@ -58,6 +60,7 @@ namespace TON
waveText.text = $"WAVE {StageManager.Singleton.waveCount + 1}";
UpdatePlayTimeDisplay();
UpdateGameScore();
}
@@ -68,7 +71,9 @@ namespace TON
private void UpdatePlayTimeDisplay()
{
float playTime = StageManager.Singleton.PlayTime;
if (_monsterSpawner != null && !_monsterSpawner.isTimerRunning)
{
float playTime = StageManager.Singleton.PlayTime - ((StageManager.Singleton.waveCount + 1) * 5);
int minutes = Mathf.FloorToInt(playTime / 60f);
int seconds = Mathf.FloorToInt(playTime % 60f);
@@ -82,6 +87,7 @@ namespace TON
playTimeText.text = cachedTimeString;
}
}
}
private void UpdateHPBar(float current, float max)
{