/// <summary> /// A pawn has been promoted and should be changed on the board /// </summary> /// <param name="pawn">The pawn that has been promoted</param> /// <param name="to">The type of piece it should be promoted to</param> public void OnPawnPromoted(BaseChessPiece pawn, PawnPromotion to) { BaseChessPiece promoted = null; switch (to) { case PawnPromotion.Queen: promoted = new Queen(this, pawn.Color, pawn.Position); break; case PawnPromotion.Rook: promoted = new Rook(this, pawn.Color, pawn.Position); break; case PawnPromotion.Knight: promoted = new Knight(this, pawn.Color, pawn.Position); break; case PawnPromotion.Bishop: promoted = new Bishop(this, pawn.Color, pawn.Position); break; } if (promoted != null) { m_Table[pawn.Position] = promoted; pawn.Die(false); } PushGame(pawn.EnemyColor, null); }
/// <summary> /// A pawn has been promoted and should be changed on the board /// </summary> /// <param name="pawn">The pawn that has been promoted</param> /// <param name="to">The type of piece it should be promoted to</param> public void OnPawnPromoted( BaseChessPiece pawn, PawnPromotion to ) { BaseChessPiece promoted = null; switch ( to ) { case PawnPromotion.Queen: promoted = new Queen( this, pawn.Color, pawn.Position ); break; case PawnPromotion.Rook: promoted = new Rook( this, pawn.Color, pawn.Position ); break; case PawnPromotion.Knight: promoted = new Knight( this, pawn.Color, pawn .Position ); break; case PawnPromotion.Bishop: promoted = new Bishop( this, pawn.Color, pawn.Position ); break; } if ( promoted != null ) { m_Table[ pawn.Position ] = promoted; pawn.Die( false ); } PushGame( pawn.EnemyColor, null ); }