Esempio n. 1
0
 /// <summary>
 /// Moves the piece after testing if it is a valid move
 /// </summary>
 /// <param name="attemptedMove">the attempted move on this current piece</param>
 public void move(Vector3 attemptedMove)
 {
     if (IsValid(attemptedMove))
     {
         AbstractPiece pieceInSpot = board.TestLocation(attemptedMove);
         if (pieceInSpot != null)
         {
             pieceInSpot.capture();
         }
         this.Location.Set(attemptedMove.x, attemptedMove.y, attemptedMove.z);
         board.Check(this, attemptedMove);
     }
 }
Esempio n. 2
0
 public void pieceCaptured(AbstractPiece pieceDead)
 {
     pieceDead.IsCaptured = true;
     if (whiteTeam.Contains(pieceDead))
     {
         whiteTeam.Remove(pieceDead);
         whiteGraveyard.Add(pieceDead);
     }
     else
     {
         blackTeam.Remove(pieceDead);
         blackGraveyard.Add(pieceDead);
     }
 }
Esempio n. 3
0
        internal bool placeSelfInCheck(AbstractPiece king, Vector3 attemptedMove)
        {
            List <AbstractPiece> listToCheck;

            if (king.Team == currentTeam.black)
            {
                listToCheck = whiteTeam;
            }
            else
            {
                listToCheck = blackTeam;
            }
            foreach (AbstractPiece piece in listToCheck)
            {
                if (piece.IsValid(attemptedMove))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 4
0
 /// <summary>
 /// Tests if the move attempted puts the opponent in check
 /// </summary>
 /// <param name="piece"></param>
 /// <param name="attemptedMove"></param>
 internal bool Check(AbstractPiece abstractPiece, Vector3 attemptedMove)
 {
     throw new NotImplementedException();
 }