2 Different Animations, 1 Button to Work With

I’m very new to Unity, and have done a bit of Actionscripting before in Flash. I’m more in the Graphics Department than actual Scripting, but am trying to learn the basics.

Example:
Let’s say I have a door I want to open and close. I press down the mouse and it opens, and press it again so it closes.
However, right now it is just forever looping on the opening door animation. I’d like for it to be interchangable, so if it played Animation 1 the next time you clicked it would play Animation 2 and then continue looping that way. :frowning:

Any help would be much appreciated!

if(Input.GetMouseButtonDown(0)){
animation.Play(‘idle’);
print(“mouseDown”);
}

var animationClips:Array = [“idle”,“idle0”];
var animationIndex:int = 0;

if(Input.GetMouseButtonDown(0)){
animation.Play(animationClips[animationIndex]);
animationIndex++;
if(animationIndex>=animationClips.length){
animationIndex= 0;
}
print(“mouseDown”);
}

Now I would just like to figure out how to not interupt the animation if it is currently playing. ~_~