#region animation관련 (플레이 백, startTIme,endTime)
public void AnimationPlayAndBack(bool isOn)
{
Debug.Log("ani.clip.name:" + animation_Tutorials[0].clip.name);
if (isOn)
{
animation_Tutorials[0][animation_Tutorials[0].clip.name].time = 0;
animation_Tutorials[0][animation_Tutorials[0].clip.name].speed = 1;
animation_Tutorials[0].Play(animation_Tutorials[0].clip.name);
}
else
{
animation_Tutorials[0][animation_Tutorials[0].clip.name].time = animation_Tutorials[0][animation_Tutorials[0].clip.name].length;
animation_Tutorials[0][animation_Tutorials[0].clip.name].speed = -1;
animation_Tutorials[0].Play(animation_Tutorials[0].clip.name);
}
}
//public void AnimationPlay(float startTime,float endTime)
//{
// animation_Tutorials[0][animation_Tutorials[0].clip.name].time = startTime;
// animation_Tutorials[0][animation_Tutorials[0].clip.name].speed = 1;
//}
public void OnAnimationPlayCustomTime(float startTime, float endTime)
{
if (cor_CustomAnimation != null)
{
StopCoroutine(cor_CustomAnimation);
cor_CustomAnimation = null;
}
cor_CustomAnimation = cor_AnimationPlayCustomTime(startTime, endTime);
StartCoroutine(cor_CustomAnimation);
Animation_StartTimes.Enqueue(startTime);
}
public void OnAnimationPlayBackCustomTime(float startTime)
{
if (cor_CustomAnimationBack != null)
{
StopCoroutine(cor_CustomAnimationBack);
cor_CustomAnimationBack = null;
}
cor_CustomAnimationBack = cor_AnimationBackPlayCustomTime(startTime);
StartCoroutine(cor_CustomAnimationBack);
}
IEnumerator PlayBack()
{
while (Animation_StartTimes.Count > 0)
{
float startTime = Animation_StartTimes.Dequeue();
float PlayTime = animation_Tutorials[0][animation_Tutorials[0].clip.name].time - startTime;
OnAnimationPlayBackCustomTime(startTime);
yield return new WaitForSeconds(PlayTime);
}
}
IEnumerator cor_AnimationPlayCustomTime(float startTime, float endTime)
{
animation_Tutorials[0][animation_Tutorials[0].clip.name].time = startTime;
animation_Tutorials[0][animation_Tutorials[0].clip.name].speed = 1;
animation_Tutorials[0].Play(animation_Tutorials[0].clip.name);
float playTime = endTime - startTime;
yield return new WaitForSeconds(playTime);
animation_Tutorials[0].Stop();
animation_Tutorials[0][animation_Tutorials[0].clip.name].time = endTime;
}
IEnumerator cor_AnimationBackPlayCustomTime(float startTime)
{
float playTime = animation_Tutorials[0][animation_Tutorials[0].clip.name].time - startTime;
animation_Tutorials[0][animation_Tutorials[0].clip.name].speed = -1;
animation_Tutorials[0].Play(animation_Tutorials[0].clip.name);
yield return new WaitForSeconds(playTime);
animation_Tutorials[0].Stop();
animation_Tutorials[0][animation_Tutorials[0].clip.name].time = startTime;
}
#endregion
댓글 없음:
댓글 쓰기