Moves the player left and right with the user Input.
This FSM exposes the Speed variable in the inspector. Modify it to speed up or down the player movement sideways.
This is a one state FSM because we constantly check for the user input.
- We reset the x velocity to avoid noise and unwanted drifting.
- We get the delta time and multiply it by the speed and user input to find out by how much we need to translate the gameObject.
- We translate the gameObject.