DO-33 [Feat] 금수가 선택 불가 추가

금수상태인 자리를 선택할 때 선택 불가능하게 함
This commit is contained in:
Lim0_C 2025-03-17 11:52:32 +09:00
parent 4c90ed3c18
commit bd3559d29b
3 changed files with 22 additions and 0 deletions

View File

@ -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))
{

View File

@ -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()
{

View File

@ -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();
}
}