From bd3559d29bcee6e4cf2bece71234e36dbed0462d Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Mon, 17 Mar 2025 11:52:32 +0900 Subject: [PATCH] =?UTF-8?q?DO-33=20[Feat]=20=EA=B8=88=EC=88=98=EA=B0=80=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=20=EB=B6=88=EA=B0=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 금수상태인 자리를 선택할 때 선택 불가능하게 함 --- Assets/Script/Game/GameLogic.cs | 4 ++++ Assets/Script/Game/Stone.cs | 11 +++++++++++ Assets/Script/Game/StoneController.cs | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 763af36..a90816f 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -161,6 +161,9 @@ public class GameLogic : MonoBehaviour //TODO: 멀티 구현 필요 break; } + + //임시 금수 + stoneController.SetStoneState(Enums.StoneState.Blocked, 3, 3); } public void OnConfirm() @@ -184,6 +187,7 @@ public class GameLogic : MonoBehaviour public void SetStoneSelectedState(int row, int col) { if (_board[row, col] != Enums.PlayerType.None) return; + if (stoneController.GetStoneState(row, col) != Enums.StoneState.None) return; //첫수 및 중복 확인 if ((selectedRow != row || selectedCol != col) && (selectedRow != -1 && selectedCol != -1)) { diff --git a/Assets/Script/Game/Stone.cs b/Assets/Script/Game/Stone.cs index fec3325..cebbaf6 100644 --- a/Assets/Script/Game/Stone.cs +++ b/Assets/Script/Game/Stone.cs @@ -13,6 +13,7 @@ public class Stone : MonoBehaviour private SpriteRenderer _spriteRenderer; public delegate void OnStoneClicked(int index); private OnStoneClicked _onStoneClicked; + private Enums.StoneState _currentStoneState; private void Awake() @@ -52,19 +53,29 @@ public class Stone : MonoBehaviour switch (stoneState) { case Enums.StoneState.None: + _currentStoneState = Enums.StoneState.None; _spriteRenderer.sprite = stoneStateSprites[0]; break; case Enums.StoneState.Selected: + _currentStoneState = Enums.StoneState.Selected; _spriteRenderer.sprite = stoneStateSprites[1]; break; case Enums.StoneState.Blocked: + _currentStoneState = Enums.StoneState.Blocked; _spriteRenderer.sprite = stoneStateSprites[2]; break; case Enums.StoneState.LastPositioned: + _currentStoneState = Enums.StoneState.LastPositioned; _spriteRenderer.sprite = stoneStateSprites[3]; break; } } + + //Stone 상태 확인 + public Enums.StoneState GetStoneState() + { + return _currentStoneState; + } private void OnMouseUpAsButton() { diff --git a/Assets/Script/Game/StoneController.cs b/Assets/Script/Game/StoneController.cs index defa129..cbafaa2 100644 --- a/Assets/Script/Game/StoneController.cs +++ b/Assets/Script/Game/StoneController.cs @@ -37,4 +37,11 @@ public class StoneController : MonoBehaviour var index = MaxCellCount * row + col; stones[index].SetState(state); } + + //스톤상태 확인 + public Enums.StoneState GetStoneState(int row, int col) + { + var index = MaxCellCount * row + col; + return stones[index].GetStoneState(); + } }