The three uphill, downhill, straight walks would be advisable if only to make the animations look more natural, since the way people walk uphill, downhill and on a flat surface are essentially different.
But if you didn't need or want that level of fidelity, it's enough to have your animations use IK targets for the feet whenever the feet are supposed to be touching the floor, and then have none of that IK influence whenever the feet are not planted on the floor.
At runtime, we would assume that your game world has physics shapes. You would do raycasts downward from where your foot would be, and then reposition the IK target bone based on where the raycast hits. The raycast origin would be raised a little to account for the case where the character would be walking uphill (where the ground would be elevated instead of lowered).
If you keep your IK target bones as a direct child of the root bone, and not modify any of the root bone's scale, rotation, position, shear, that simplifies the math a lot. If your raycasts are done in your game world-space, you convert it to skeleton-space using an inverse transform function (or world-to-local function), before using the position value to set the position of the IK target bones. Your game engine should provide this for you.
If the engine you are using just has the skeleton transform as a position x and y, then the inverse transform function amounts to just subtracting the skeleton's game world position from the returned raycast positions so you get a position that is within skeleton-space.
The rest of the task is to just making sure your animation looks nice while using said IK targets.