From 959c967cf1efc8dae7e2d89ce7b28304ae6e934f Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Mon, 17 Mar 2025 16:03:31 +0900 Subject: [PATCH] =?UTF-8?q?DO-33=20[Refactor]=20GameLogic=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Script/Game/GameLogic.cs | 37 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index e47a007..01672cf 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -16,7 +16,7 @@ public abstract class BasePlayerState gameLogic.fioTimer.PauseTimer(); gameLogic.SetNewBoardValue(playerType, row, col); - //TODO: 승리확인 + if (gameLogic.CheckGameWin(playerType, row, col)) { GameManager.Instance.OpenConfirmPanel($"Game Over: {playerType} Win",() =>{}); @@ -24,6 +24,7 @@ public abstract class BasePlayerState } else { + //TODO: 무승부 확인 HandleNextTurn(gameLogic); } @@ -44,6 +45,8 @@ public class PlayerState : BasePlayerState { gameLogic.fioTimer.StartTimer(); + //TODO: 첫번째 플레이어면 렌주 룰 확인 + gameLogic.currentTurn = _playerType; gameLogic.stoneController.OnStoneClickedDelegate = (row, col) => { @@ -188,9 +191,6 @@ public class GameLogic : MonoBehaviour //TODO: 멀티 구현 필요 break; } - - //임시 금수 - stoneController.SetStoneState(Enums.StoneState.Blocked, 3, 3); } //착수 버튼 클릭시 호출되는 함수 public void OnConfirm() @@ -235,26 +235,29 @@ public class GameLogic : MonoBehaviour public void SetNewBoardValue(Enums.PlayerType playerType, int row, int col) { if (_board[row, col] != Enums.PlayerType.None) return; - - if (playerType == Enums.PlayerType.PlayerA) + + switch (playerType) { - stoneController.SetStoneType(Enums.StoneType.Black, row, col); - stoneController.SetStoneState(Enums.StoneState.LastPositioned, row, col); - _board[row, col] = Enums.PlayerType.PlayerA; - LastNSelectedSetting(row, col); - } - if (playerType == Enums.PlayerType.PlayerB) - { - stoneController.SetStoneType(Enums.StoneType.White, row, col); - stoneController.SetStoneState(Enums.StoneState.LastPositioned, row, col); - _board[row, col] = Enums.PlayerType.PlayerB; - LastNSelectedSetting(row, col); + case Enums.PlayerType.PlayerA: + stoneController.SetStoneType(Enums.StoneType.Black, row, col); + stoneController.SetStoneState(Enums.StoneState.LastPositioned, row, col); + _board[row, col] = Enums.PlayerType.PlayerA; + LastNSelectedSetting(row, col); + break; + case Enums.PlayerType.PlayerB: + stoneController.SetStoneType(Enums.StoneType.White, row, col); + stoneController.SetStoneState(Enums.StoneState.LastPositioned, row, col); + _board[row, col] = Enums.PlayerType.PlayerB; + LastNSelectedSetting(row, col); + break; } + } //돌 지우는 함수 public void RemoveStone(int row, int col) { + _board[row, col] = Enums.PlayerType.None; stoneController.SetStoneType(Enums.StoneType.None, row, col); stoneController.SetStoneState(Enums.StoneState.None, row, col); }