Play a second animation after the first one has been activated

I am making a menu without any GUIs cause GUIs SUCK. Just kidding, I find it easier and a little cooler to do it all with pictures. I have a button to the side that scrolls out when you click it. It has an idle animation attached and in the controller I added another animation with a bool requirement, so that way it doesnt play until the script tells it to. Here is the script…

#pragma strict

function OnMouseOver(){
if(Input.GetMouseButtonDown(0)){
var myAnimator: Animator= GetComponent(Animator);
         myAnimator.SetBool("open",true);
    }
}

It works great, except that I have no idea how to close the menu once it’s open. Is there a way to make the script recognize that the button has been pressed twice? I thought about that… if the script could do that and make a counter, then it would stop playing any animations after it counts to two. See my problem? So how can I get the menu to open and close? Thanks.

Edit: I was going to add a close button, but the menu is a parent of the open button and has the animations on it. So I couldn’t do that to my knowledge. I’ll attach a photo, in case there is any confusion.

The “Alpha Tools” button is what I’m working with.

51189-alpha.png

Always when I wanted to check double-click, I used a timer which was restarted after one click. If there was second click before 0.4 s, it was recognized as double-click. Then you should set the “open” bool again to false and create a transition in Animator from open state to close state.

[Edit] Yes, I didn’t understand the problem. You can make a function that do this:

bool open = false;
void Function(){
open = !open
}
That will change bool open from false to true, and from true to false. Then create apropriate transitions(one for true - opening, and one for false - closing) in Animator and you are done;