Animation at the end of the level

Hi. I have a game with one animation in it. The animation should be played at the end of each level. How to connect the script with the animation? For now, the animation is played at the begining of the level and then I can’t move my player.

Can somebody help me fix this?

In animation component, uncheck “Play Automatically”.

function LoadNextLevel (level_to_load : int) {
animation.Play(animation.clip.name);
yield WaitForSeconds (animation.clip.length);
Application.LoadLevel (level_to_load);
}

This plays the animation and waits for it to end before loading new level.

EDIT:

The first code is in javascript, this is in C# :

IEnumerator LoadNextLevel (int level_to_load) {
animation.Play(animation.clip.name);
yield return new WaitForSeconds(animation.clip.length);
Application.LoadLevel(level_to_load);
}