virtual protected void AniUpdate() { if (!CanPlay) { SetEnable(false); return; } mAnimator.Update(UnScaledTime ? Time.unscaledDeltaTime : Time.deltaTime); if (IsDone) { GoToEnd(); } }
void UpdateAnimation(GameObject go) { animtionDeltaTime = (float)EditorApplication.timeSinceStartup - lastAnimationTime; animationTime += animtionDeltaTime; lastAnimationTime = (float)EditorApplication.timeSinceStartup; if (go) { var anim = go.GetComponent <Animation>(); if (anim) { if (!anim.isPlaying) { anim.Play(); } if (animationTime > anim.clip.length) { animationTime = 0; } if (!AnimationMode.InAnimationMode()) { AnimationMode.StartAnimationMode(); } AnimationMode.SampleAnimationClip(skeleton, anim.clip, animationTime); //AnimationMode.StopAnimationMode(); } else { Animator animator = go.GetComponent <Animator>(); if (animator) { animator.Update(animtionDeltaTime); } } } }
public void RestoreAnimatorState(Animator animator) { animator.applyRootMotion = applyRootMotion; animator.updateMode = updateMode; animator.cullingMode = cullingMode; if (animator.layerCount == stateHashes.Length) { for (int i = 0; i < animator.layerCount; i++) { animator.Play(stateHashes[i], i, stateTimes[i]); } } animator.Update(0.00001f); animator.enabled = animating; }