From 6987ca6376b850b8a2108e1cc6d838e645b699bb Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Fri, 14 Mar 2025 10:21:43 +0900 Subject: [PATCH] =?UTF-8?q?DO-8=20=EB=B3=91=ED=95=A9=20=EC=A0=84=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Script/Game/GameLogic.cs | 39 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 433e3f6..0f97d4d 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -24,15 +24,12 @@ public class GameLogic : MonoBehaviour lastRow = -1; lastCol = -1; - SetTurn(Enums.PlayerType.PlayerA); - } - - private void SetState() - { + currentTurn = Enums.PlayerType.PlayerA; + SetState(currentTurn); } - private void SetTurn(Enums.PlayerType player) + private void SetState(Enums.PlayerType player) { currentTurn = player; _stoneController.OnStoneClickedDelegate = (row, col) => @@ -60,28 +57,34 @@ public class GameLogic : MonoBehaviour _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); } - - //첫수 확인 - if (lastRow != -1 || lastCol != -1) - { - _stoneController.SetStoneState(Enums.StoneState.None, lastRow, lastCol); - } - //마지막 좌표 저장 - lastRow = row; - lastCol = col; - //선택 좌표 초기화 - selectedRow = -1; - selectedCol = -1; } } + private void LastNSelectedSetting(int row, int col) + { + //첫수 확인 + if (lastRow != -1 || lastCol != -1) + { + _stoneController.SetStoneState(Enums.StoneState.None, lastRow, lastCol); + } + //마지막 좌표 저장 + lastRow = row; + lastCol = col; + //선택 좌표 초기화 + selectedRow = -1; + selectedCol = -1; + } + //스톤의 상태변경 명령함수 private void SetStoneNewState(Enums.StoneState state, int row, int col) {