Press keyboard key to play animation using different animations per assigned key

With animation always start with the animator / animation setup itself. You can clear the scene, pull in the animated object, then while the game is running, use the Animator window to wiggle all the properties to make sure it does what you want when you set it.

If you can’t get it to work by hand-setting the properties, nothing you do in code will matter, obviously.

Usually for one-shot things like a dance you use .SetTrigger, not .SetBool… then mark the dance animation to cleanly exit on its own. No need for coroutines or other silliness. If you really do need to know when the animation ends you can either query the animator for what state it is in, or else implement a state machine behaviour override to tell your code, or even just Animation Events.

AnimationEvents:

Otherwise, it just sounds like you wrote a bug… and that means… time to start debugging!

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.