Exemple #1
0
        public void CheckMovePieces(EPieces ePieces, ESelectStartColor eSelectSide, Vector2Int slot)
        {
            _allSlot = new List <Vector2Int>();
            _slot    = slot;
            _side    = eSelectSide;

            switch (ePieces)
            {
            case EPieces.Pawn: PawnMove(); break;

            case EPieces.Rook: RookMove(); break;

            case EPieces.Knight: KnightMove(); break;

            case EPieces.Bishop: BishopMove(); break;

            case EPieces.Queen: QueenMove(); break;

            case EPieces.King: KingMove(); break;

            default: break;
            }

            CheckInteractBoard();
        }
Exemple #2
0
        void Start()
        {
            _thisTog.onValueChanged.AddListener((result) =>
            {
                if (_thisTog.isOn && isFirstSelect)
                {
                    ESelectStartColor selectStartColor = BoardManage.instance.presentPieces.eSelectSide;
                    var _remove = selectStartColor.Equals(ESelectStartColor.FirstColor) ? BoardManage.instance.chessManage.allPiecesFirstPlayers.Remove(BoardManage.instance.presentPieces) : BoardManage.instance.chessManage.allPiecesSecondPlayers.Remove(BoardManage.instance.presentPieces);
                    BoardManage.instance.presentTargetBox.ClearChild();
                    BasePieces _piece  = Instantiate(SelectPieces(), BoardManage.instance.presentTargetBox.transform);
                    _piece.eSelectSide = selectStartColor;

                    if (selectStartColor.Equals(ESelectStartColor.FirstColor))
                    {
                        _piece.meshRdr.material = BoardManage.instance.firstPlayerMat;
                        BoardManage.instance.chessManage.allPiecesFirstPlayers.Add(_piece);
                    }
                    else
                    {
                        _piece.meshRdr.material = BoardManage.instance.secondPlayerMat;
                        BoardManage.instance.chessManage.allPiecesSecondPlayers.Add(_piece);
                    }
                    EnchantPawn.CallBackSelectEnchant?.Invoke(false);
                }
                isFirstSelect = result;
            });
        }
    public void SwichTurn()
    {
        subBoardMovePieces.ClearBorad();
        presentPieces    = null;
        presentTargetBox = null;

        eTurnPlayer = ~(eTurnPlayer - 1);
    }
Exemple #4
0
        void SpawnPieceSingle(ESelectStartColor eSelectStartColor, BasePieces piece, Vector2Int slot, Material mat, List <BasePieces> basePieces)
        {
            Spawn(BoardManage.instance.detailBoxes[slot.x].boxManages[slot.y].transform);
            void Spawn(Transform parentPiece)
            {
                BasePieces _pieces = Instantiate(piece, parentPiece);

                _pieces.eSelectSide      = eSelectStartColor;
                _pieces.meshRdr.material = mat;
                basePieces.Add(_pieces);
            }
        }
Exemple #5
0
 void Start()
 {
     _selectStartColor = GetComponent <BasePieces>().eSelectSide;
     BoardManage.instance.chessManage.CallBackCheckKingCheckmate += CheckPiecesEatKing;
 }