Hello there folks,
i have following function, which is called in Update() (i am using Smooth Moves for the Animations by the way):
void SheepAnimation()
{
if(m_bFinished == false)
{
BA_Wollkuh.Play("Eating");
m_bFinished = true;
}
if(m_bFinished == true)
{
if(!BA_Wollkuh.IsPlaying("Eating"))
{
BA_Wollkuh.CrossFade("EatingGrass_1");
}
}
m_fBlinktimeLeft -= Time.deltaTime;
if(BA_Wollkuh.IsPlaying("EatingGrass_1"))
{
if(m_fBlinktimeLeft <= 0)
{
BA_Wollkuh.Play("Blinking");
m_fBlinktimeLeft = UnityEngine.Random.Range(m_fminBlinktime, m_fmaxBlinktime);
}
m_fRolleyetimeLeft -= Time.deltaTime;
Debug.Log(m_fBlinktimeLeft);
if(m_fRolleyetimeLeft <= -15)
{
if(BA_Wollkuh.IsPlaying("Blinking"))
{
BA_Wollkuh.Play("Rolleyes");
}
}
}
I have the Variable called float “m_fBlinktimeLeft” and i change the value by -= Time.deltaTime. As you see, after it is below 0 an animation is played, after that another value is counted down, till it reaches -15, when the “Blinking”-Animation stops and the other called “Rolleyes” starts.
My question is: I want to switch back to the “Blinking”-Animation after an certain amount of time, like 20 seconds (that means, the “Rolleyes”-Animation was played then for 20 seconds in the loop) and i wanted to know, HOW i set my “m_fBlinktimeLeft”-Value back to the value it had before the script started.
If i set it anywhere in the function to 0, nothing works properly (of course), because, well yeah, it is set to zero, and there is no “Blinking”-Animation at all.
Thanks in advance!