calling the same animation 2 times in update function

how to call the same animation 2 times in update function when using time method

var min : int;
var sec : int;
var fraction : int;
var timecount : float;
var starttime : float;
var timeCounter : GUIText;

function Start ()
{
starttime = Time.time;
}

function Update () {
timecount = Time.time - starttime;
min = (timecount/60f);
sec = (timecount % 60f);


fraction = ((timecount * 10) %10);
timeCounter.text = String.Format("{00:00}:{1:00}:{2:00}",min,sec,fraction);

 

if(sec<=3)
{
animation.Play("Take 001");
Debug.Log("wow");
}
if(sec>4&sec<10)
{
animation.Play("WaggingTail");
Debug.Log("et");
}
if(sec>=11&sec<12)
{
animation.Play("Sad");
Debug.Log("wa");
}
if(sec>=13&sec<24)
{
animation.Play("Barking");
Debug.Log("bang");

}
if(sec>25&sec<33)
{
animation.CrossFade("Growling");
Debug.Log("bang");

}
if(sec>34&sec<36)
{
animation.CrossFade("Take 001");
Debug.Log("bang");

}
if(sec>37&sec<44)
{
animation.CrossFadeQueued("Barking");
Debug.Log("bang");

}
}

when i calling the barking for second time its not working.why?

http://forum.unity3d.com/threads/44441-XML-Reading-a-XML-file-in-Unity-How-to-do-it

OK, in tinkering with this, I believe that your problem lies in Take 001. It loops. Since it loops, it never ends… and since it never ends, you cant queue it in CrossFadeQueued.

You can either create a new animation, that lasts the time allotted and does not loop, or set the Barking at that point to CrossFade, not queued.

I think using this:

would greatly simplify what you are trying to do.

Hmmmm… I think he would have to know how to use Coroutines for that. :wink:

He is using UnityScript which is a lot simpler when using coroutines. I love coroutines in C# though, they make timing
stuff so easy.