public GridTile FindTileInRowColumnCoordinates(int targetColumn, int targetRow) { GridTile foundTile = new EmptyTile(targetColumn, targetRow, tileWidth, tileHeight); foreach (GridTile n in gridTiles) { if (n.Column == targetColumn && n.Row == targetRow) { foundTile = n; return(foundTile); } } return(foundTile); }
public GridTile FindTileInPixelCoordinates(float targetX, float targetY) { GridTile foundTile = new EmptyTile(-1, -1, tileWidth, tileHeight); foreach (GridTile n in gridTiles) { if ((n.Column * tileWidth) <= targetX && (n.Column * tileWidth) + tileWidth >= targetX && (n.Row * tileHeight) <= targetY && (n.Row * tileHeight) + tileHeight >= targetY) { foundTile = n; break; } } return(foundTile); }