public List <PlayerPiece> GetPlayerPiecesBasedOnEntityType(EntityType entityType) { var playerPieces = new List <PlayerPiece>(); for (int row = 0; row < Rows; row++) { for (int column = 0; column < Columns; column++) { if (ChessBoardCells[row, column].IsOccupied) { Entity entity = ChessBoardCells[row, column].Entity; if (entity.Type == entityType) { var playerPiece = new PlayerPiece { EntityID = entity.ID, }; playerPiece.CurrentPosition = new ChessBoardPosition { CurrentRow = row, CurrentColumn = column, }; playerPieces.Add(playerPiece); } } } } return(playerPieces); }
public Entity GetEntity(PlayerPiece playerPiece) { ChessBoardCell cell = GetCell(playerPiece.CurrentPosition); return(cell.Entity); }