Open/Close Chest with delay

Hello! In the scene I have an object(chest) which should be opened by clicking the mouse. (Of course I have all the animations and Box Collider) ![alt text][1]

But! I need to chest could not be opened and closed to everyone mouse click. Between animations should be delay for 2 seconds.
I have a C# script, where a chest can have 3 states (Open, Close and Inbetween). At start chest have state “Close”. When i click on it, state chenge to “Inbetween” but then nothing happens although the state must change On “Open”.

Script
"using UnityEngine;
using System.Collections;

public class Chest : MonoBehaviour {
public enum State {
open,
close,
inbetween
}

public State state;

// Use this for initialization
void Start () {
state = Chest.State.close;

}

// Update is called once per frame
void Update () {

}

public void OnMouseEnter() {
Debug.Log(“Enter”);
}

public void OnMouseExit() {
Debug.Log(“Exit”);
}

public void OnMouseUp() {
Debug.Log(“Up”);
switch(state){
case State.close:
state = Chest.State.inbetween;
StartCoroutine(“Open”);
break;
case State.open:
state = Chest.State.inbetween;
StartCoroutine(“Close”);
break;
}

}

private IEnumerable Open() {
animation.Play(“open”);

yield return new WaitForSeconds(animation[“open”].length);

state = Chest.State.open;
}

private IEnumerable Close() {
animation.Play(“close”);
yield return new WaitForSeconds(animation[“close”].length);

state = Chest.State.close;

}
}
"
1260220–55273–$Chest.cs (1.03 KB)

How can I fix it? Thanks in advance

P.S. Sorry for my english

after you set it to play the close animation, check if(!animation.isPlaying) then start the counter, and change chest status to resting or whatever. in this state it cannot be opened. or you can use coroutines to start the counter with a delay equal to animation.length. there are many ways to do this.