예제 #1
0
파일: Queen.cs 프로젝트: Bajena/Checkers
 public override bool CanEat(CheckersPiece piece)
 {
     if (piece==null) return false;
     BoardPosition[][] possiblePos = this.PossiblePaths;
     for(int i =0; i<IncMov.Length; i++)
     {
         BoardPosition p = new BoardPosition(piece.X+IncMov[i].X, piece.Y+IncMov[i].Y);
         if (this.ParentBoard.IsInsideBoard(p.X, p.Y) && this.ParentBoard.IsEmptyCell(p.X, p.Y) && CanMoveTo(p.X, p.Y, possiblePos)) return true;
     }
     return false;
 }
예제 #2
0
파일: Pawn.cs 프로젝트: Bajena/Checkers
 public override bool CanEat(CheckersPiece piece)
 {
     return false;
 }
예제 #3
0
 /// <summary>
 /// When overriden on a derivated class should return if the give piece can be eaten by this piece or not 
 /// </summary>
 /// <param name="piece"></param>
 /// <returns></returns>
 public abstract bool CanEat(CheckersPiece piece);