From cdf197b358a3123ab29d96c35dc4615e428ba1f1 Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Wed, 26 Mar 2025 13:48:27 +0900 Subject: [PATCH] =?UTF-8?q?DO-62=20[Fix]=20=EC=B0=A9=EC=88=98=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=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 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 4a710d8..dc0debe 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -12,6 +12,10 @@ public abstract class BasePlayerState public abstract void OnExit(GameLogic gameLogic); public abstract void HandleMove(GameLogic gameLogic, int row, int col); public abstract void HandleNextTurn(GameLogic gameLogic); + + protected string _roomId; + protected bool _isMultiplay; + protected MultiplayManager _multiplayManager; public void ProcessMove(GameLogic gameLogic, Enums.PlayerType playerType, int row, int col) { @@ -20,6 +24,12 @@ public abstract class BasePlayerState gameLogic.SetNewBoardValue(playerType, row, col); gameLogic.CountStoneCounter(); + if (_isMultiplay) + { + Debug.Log("row: " + row + "col: " + col); + _multiplayManager.SendPlayerMove(_roomId, new Vector2Int(row, col)); + } + if (gameLogic.CheckGameWin(playerType, row, col)) { var gameResult = playerType == Enums.PlayerType.PlayerA? Enums.GameResult.Win:Enums.GameResult.Lose; @@ -53,10 +63,6 @@ public class PlayerState : BasePlayerState private Enums.PlayerType _playerType; private bool _isFirstPlayer; - private MultiplayManager _multiplayManager; - private string _roomId; - private bool _isMultiplay; - public PlayerState(bool isFirstPlayer) { _isFirstPlayer = isFirstPlayer; @@ -108,11 +114,6 @@ public class PlayerState : BasePlayerState public override void HandleMove(GameLogic gameLogic, int row, int col) { gameLogic.SetStoneSelectedState(row, col); - if (_isMultiplay) - { - Debug.Log("row: " + row + "col: " + col); - _multiplayManager.SendPlayerMove(_roomId, new Vector2Int(row, col)); - } } public override void HandleNextTurn(GameLogic gameLogic)