private void RemovePotentialTakenEnemy(Pieces piece) { Pieces tempPiece = null; foreach (var EnemyPiece in TempGameBoard) { if (CompareMyPositionWithEnemyPosition(piece, EnemyPiece)) { tempPiece = EnemyPiece; break; } } TempGameBoard.Remove(tempPiece); tempPiece = null; foreach (var EnemyPiece in Enemies) { if (CompareMyPositionWithEnemyPosition(piece, EnemyPiece)) { tempPiece = EnemyPiece; break; } } Enemies.Remove(tempPiece); }
// Check if current move is protected by allied piece and returns bool depending on true or false private bool WillIBeProtected(Move move, Pieces piece) { TempGameBoard.Remove(GetPieceFromTempBoard(piece)); if (AmIProtected(move, piece.PieceColor) > 0) { RestoreTempGameBoard(); return(true); } else { RestoreTempGameBoard(); return(false); } }