DO-70 [Feat] 리뷰 피드백하여 싱글 플레이 경우 반영

This commit is contained in:
Jay 2025-03-27 14:08:52 +09:00
parent 9ffb563353
commit fb7a3c40a1

View File

@ -277,16 +277,17 @@ public class GameLogic : MonoBehaviour
this.fioTimer.InitTimer(); this.fioTimer.InitTimer();
//timer 시간초과시 진행 함수 //timer 시간초과시 진행 함수
this.fioTimer.OnTimeout = () => this.fioTimer.OnTimeout = () =>
{
if (gameType == Enums.GameType.MultiPlay)
{ {
// 현재 턴의 플레이어가 로컬(유저)인지 확인 // 현재 턴의 플레이어가 로컬(유저)인지 확인
bool isCurrentPlayerLocal = (currentTurn == Enums.PlayerType.PlayerA && firstPlayerState is PlayerState) || bool isCurrentPlayerLocal = (currentTurn == Enums.PlayerType.PlayerA && firstPlayerState is PlayerState) ||
(currentTurn == Enums.PlayerType.PlayerB && secondPlayerState is PlayerState); (currentTurn == Enums.PlayerType.PlayerB && secondPlayerState is PlayerState);
if (isCurrentPlayerLocal) // 내가 타임 오버일 때 if (isCurrentPlayerLocal) // 내가 타임 오버일 때
{
if (this.gameType == Enums.GameType.MultiPlay) // 멀티플레이인 경우
{ {
_multiplayManager?.SendTimeout(); _multiplayManager?.SendTimeout();
}
GameManager.Instance.panelManager.OpenEffectPanel(Enums.GameResult.Lose); GameManager.Instance.panelManager.OpenEffectPanel(Enums.GameResult.Lose);
EndGame(Enums.GameResult.Lose); EndGame(Enums.GameResult.Lose);
} }
@ -296,22 +297,6 @@ public class GameLogic : MonoBehaviour
GameManager.Instance.panelManager.OpenConfirmPanel("상대방의 응답을 기다리는 중입니다", GameManager.Instance.panelManager.OpenConfirmPanel("상대방의 응답을 기다리는 중입니다",
() => { } ); () => { } );
} }
}
else
{
if (currentTurn == Enums.PlayerType.PlayerA)
{
GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: {Enums.PlayerType.PlayerB} Win",
() => { });
EndGame(Enums.GameResult.Lose);
}
else if (currentTurn == Enums.PlayerType.PlayerB)
{
GameManager.Instance.panelManager.OpenConfirmPanel($"Game Over: {Enums.PlayerType.PlayerA} Win",
() => { });
EndGame(Enums.GameResult.Win);
}
}
}; };
} }
@ -522,7 +507,7 @@ public class GameLogic : MonoBehaviour
// 기존 멀티플레이 상태 초기화 // 기존 멀티플레이 상태 초기화
_multiplayManager = null; _multiplayManager = null;
_roomId = null; _roomId = null;
gameType = Enums.GameType.SinglePlay; this.gameType = Enums.GameType.SinglePlay;
// 싱글 플레이 상태로 변경 // 싱글 플레이 상태로 변경
firstPlayerState = new PlayerState(true); firstPlayerState = new PlayerState(true);