Exemple #1
0
 void setAdjacentPiece(AdjacentPiece whichPiece, Piece piece)
 {
     switch (whichPiece)
     {
         case AdjacentPiece.Above: above = piece; break;
         case AdjacentPiece.Below: below = piece; break;
         case AdjacentPiece.LeftTop: lefttop = piece; break;
         case AdjacentPiece.LeftBottom: leftbottom = piece; break;
         case AdjacentPiece.RightTop: righttop = piece; break;
         case AdjacentPiece.RightBottom: rightbottom = piece; break;
     }
 }
Exemple #2
0
 private void checkRightBottom(Board board)
 {
     Piece temp = rightbottom;
     rightbottom = board.getPieceOnScreen(location + RightBottomOffSet);
     if (temp == null && rightbottom != null) { rightbottom.CheckAdjacentPieces(board); }
 }
Exemple #3
0
 private void checkRightTop(Board board)
 {
     Piece temp = righttop;
     righttop = board.getPieceOnScreen(location + RightTopOffSet);
     if (temp == null && righttop != null) { righttop.CheckAdjacentPieces(board); }
 }
Exemple #4
0
 private void checkLeftTop(Board board)
 {
     Piece temp = lefttop;
     lefttop = board.getPieceOnScreen(location + LeftTopOffSet);
     if (temp == null && lefttop != null) { lefttop.CheckAdjacentPieces(board); }
 }
Exemple #5
0
 private void checkLeftBottom(Board board)
 {
     Piece temp = leftbottom;
     leftbottom = board.getPieceOnScreen(location + LeftBottomOffSet);
     if (temp == null && leftbottom != null) { leftbottom.CheckAdjacentPieces(board); }
 }
Exemple #6
0
 private void checkBelow(Board board)
 {
     Piece temp = below;
     below = board.getPieceOnScreen(location + BelowOffSet);
     if (temp == null && below != null) { below.CheckAdjacentPieces(board); }
 }
Exemple #7
0
 private void checkAbove(Board board)
 {
     Piece temp = above;
     above = board.getPieceOnScreen(location + AboveOffSet);
     if (temp == null && above != null) { above.CheckAdjacentPieces(board); }
 }
Exemple #8
0
        void updateBoard(Piece piece)
        {
            int temp = 0;

            //piece.CheckAdjacentPieces(this);

            if (piece.getLeftTop() == null)
            {
                Piece newLT = new Piece(piece.getLocation() + Piece.LeftTopOffSet);
                //piece.setLeftTop(newLT);
                board.Add(newLT);
                temp = 50;
            }
            if (piece.getLeftBottom() == null)
            {
                Piece newLB = new Piece(piece.getLocation() + Piece.LeftBottomOffSet);
                //piece.setLeftBottom(newLB);
                board.Add(newLB);
            }
            if (piece.getRightTop() == null)
            {
                Piece newRT = new Piece(piece.getLocation() + Piece.RightTopOffSet);
                //piece.setRightTop(newRT);
                board.Add(newRT);
                temp = 50;
            }
            if (piece.getRightBottom() == null)
            {
                Piece newRB = new Piece(piece.getLocation() + Piece.RightBottomOffSet);
                //piece.setRightBottom(newRB);
                board.Add(newRB);
            }
            if (piece.getAbove() == null)
            {
                Piece newAbove = new Piece(piece.getLocation() + Piece.AboveOffSet);
                //piece.setAbove(newAbove);
                board.Add(newAbove);
                temp = 100;
            }
            if (piece.getBelow() == null)
            {
                Piece newBelow = new Piece(piece.getLocation() + Piece.BelowOffSet);
                //piece.setBelow(newBelow);
                board.Add(newBelow);
            }

            piece.CheckAdjacentPieces(this);
        }