public void SetAnimationTime(string animationName, float time) { CachedLegacyAnimation[animationName].normalizedTime = time; if (CachedLegacyAnimation.IsPlaying(animationName)) { lastAnimationUpdateTime = GetNormalizedAnimationTime(animationName); } }
public void SetAnimationSpeed(string animationName, float speed) { CachedLegacyAnimation[animationName].speed = speed; if (CachedLegacyAnimation.IsPlaying(animationName)) { lastAnimationUpdateTime = GetNormalizedAnimationTime(animationName); } }
public bool IsPlayingAnimation(string animation) { if (CachedLegacyAnimation.IsPlaying(animation)) { if (animation != currentPlayingClipName) { Debug.LogWarning("Animation cached clip name is out of sync!"); currentPlayingClipName = animation; } return(true); } return(false); }
void LateUpdate() { if (animationSubscriptions.Count == 0) { return; } bool endEvent = false; if (!CachedLegacyAnimation.isPlaying) { if (!string.IsNullOrEmpty(currentPlayingClipName)) { endEvent = true; } else { return; } } if (!endEvent && !CachedLegacyAnimation.IsPlaying(currentPlayingClipName)) { Debug.LogWarning("Clip name cache out of sync."); return; } float animationTime = GetNormalizedAnimationTime(currentPlayingClipName); TriggerEventsForTimeRange(lastAnimationUpdateTime, animationTime); lastAnimationUpdateTime = animationTime; if (endEvent) { currentPlayingClipName = null; lastAnimationUpdateTime = 0f; } }