/// <summary> /// Checks if an unit is captured and if yes kills the unit /// </summary> /// <param name="piece"></param> /// <param name="preyColumn"></param> /// <param name="preyRow"></param> /// <param name="otherSideColumn"></param> /// <param name="otherSideRow"></param> /// <param name="col1">Column of third position next to prey</param> /// <param name="row1">Row of third position next to prey</param> /// <param name="col2">Column of 4th position next to prey </param> /// <param name="row2">Row of 4th position next to prey</param> void CheckNormalCapture(Piece piece, int preyColumn, int preyRow, int otherSideColumn, int otherSideRow, int col1, int row1, int col2, int row2) { if (IsInside(otherSideColumn, otherSideRow)) { Piece posibleAttacker = Board[otherSideColumn, otherSideRow]; if (posibleAttacker == null) { if (IsRestricted(otherSideColumn, otherSideRow)) { posibleAttacker = piece; } else { return; } } Piece prey = Board[preyColumn, preyRow]; if (prey != null) { Piece piece1; Piece piece2; piece1 = IsInside(col1, row1) ? Board[col1, row1] : null; piece2 = IsInside(col2, row2) ? Board[col2, row2] : null; piece1 = piece1 == null && IsRestricted(col1, row1) ? piece : piece1; piece2 = piece2 == null && IsRestricted(col2, row2) ? piece : piece2; prey.BeAttacked(piece, posibleAttacker, piece1, piece2); } } }