Esempio n. 1
0
        public bool move(int fromColumn, int fromRow, int toColumn, int toRow)
        {
            bool isMovePossible = chessboardArray[fromRow, fromColumn].isMovePossible(toRow, toColumn);

            if (isMovePossible)
            {
                if (chessboardArray[toRow, toColumn].GetType().Name == "King")
                {
                    lastTeam = Team.NONE;
                }
                chessboardArray[toRow, toColumn]     = chessboardArray[fromRow, fromColumn];
                chessboardArray[fromRow, fromColumn] = new Pieces(fromRow, fromColumn, Team.NONE, rule);
                chessboardArray[toRow, toColumn].setX(toColumn);
                chessboardArray[toRow, toColumn].setY(toRow);
                changeTeam();
            }
            return(isMovePossible);
        }
Esempio n. 2
0
 public void createUnit(Pieces chessUnit)
 {
     chessboardArray[chessUnit.getY(), chessUnit.getX()] = chessUnit;
 }
Esempio n. 3
0
 public Boolean sameTeam(Pieces piece1, Pieces piece2)
 {
     return(piece1.getTeam() == piece2.getTeam());
 }
Esempio n. 4
0
 public Boolean isOppositeTeam(Pieces piece1, Pieces piece2)
 {
     return((piece1.getTeam() == Team.BLACK && piece2.getTeam() == Team.WHITE) || (piece1.getTeam() == Team.WHITE && piece2.getTeam() == Team.BLACK));
 }
Esempio n. 5
0
 public bool isTeamsTurn(Pieces piece)
 {
     return(piece.getTeam() != Team.NONE && piece.getTeam() != lastTeam);
 }