/// <summary> /// Like PlayAnim, but plays the animation in reverse. /// See <see cref="PlayAnim"/>. /// </summary> /// <param name="anim">Reference to the animation to play in reverse.</param> public void PlayAnimInReverse(UVAnimation_Multi anim) { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 if (deleted || !gameObject.activeInHierarchy) #else if (deleted || !gameObject.active) #endif { return; } if (!m_started) { Start(); } curAnim = anim; curAnim.Reset(); curAnim.PlayInReverse(); // Ensure the framerate is not 0 so we don't // divide by zero: if (anim.framerate != 0.0f) { timeBetweenAnimFrames = 1f / anim.framerate; } else { timeBetweenAnimFrames = 1f; // Just some dummy value since it won't be used } timeSinceLastFrame = timeBetweenAnimFrames; // Only add to the animated list if // the animation has more than 1 frame: if ((anim.GetFrameCount() > 1 || anim.onAnimEnd != UVAnimation.ANIM_END_ACTION.Do_Nothing) && anim.framerate != 0.0f) { StepAnim(0); // Start coroutine if (!animating) { //animating = true; AddToAnimatedList(); //StartCoroutine(AnimationPump()); } } else { // Make sure we are no longer in the animation pump: PauseAnim(); // Since this is a single-frame anim, // call our delegate before setting // the frame so that our behavior is // consistent with multi-frame anims: if (animCompleteDelegate != null) { animCompleteDelegate(this); } StepAnim(0); } }
/// <summary> /// Like PlayAnim, but plays the animation in reverse. /// See <see cref="PlayAnim"/>. /// </summary> /// <param name="anim">Reference to the animation to play in reverse.</param> public void PlayAnimInReverse(UVAnimation_Multi anim) { curAnim = anim; curAnim.Reset(); curAnim.PlayInReverse(); // Ensure the framerate is not 0 so we don't // divide by zero: anim.framerate = Mathf.Max(0.0001f, anim.framerate); timeBetweenAnimFrames = 1f / anim.framerate; timeSinceLastFrame = timeBetweenAnimFrames; // Only add to the animated list if // the animation has more than 1 frame: if (anim.GetFrameCount() > 1) { StepAnim(0); // Start coroutine if (!animating) { //animating = true; AddToAnimatedList(); //StartCoroutine(AnimationPump()); } } else { // Since this is a single-frame anim, // call our delegate before setting // the frame so that our behavior is // consistent with multi-frame anims: if (animCompleteDelegate != null) { animCompleteDelegate(this); } StepAnim(0); } }
/// <summary> /// Like PlayAnim, but plays the animation in reverse. /// See <see cref="PlayAnim"/>. /// </summary> /// <param name="anim">Reference to the animation to play in reverse.</param> public void PlayAnimInReverse(UVAnimation_Multi anim) { if (deleted || !gameObject.active) return; if (!m_started) Start(); curAnim = anim; curAnim.Reset(); curAnim.PlayInReverse(); // Ensure the framerate is not 0 so we don't // divide by zero: if (anim.framerate != 0.0f) { timeBetweenAnimFrames = 1f / anim.framerate; } else { timeBetweenAnimFrames = 1f; // Just some dummy value since it won't be used } timeSinceLastFrame = timeBetweenAnimFrames; // Only add to the animated list if // the animation has more than 1 frame: if ((anim.GetFrameCount() > 1 || anim.onAnimEnd != UVAnimation.ANIM_END_ACTION.Do_Nothing) && anim.framerate != 0.0f) { StepAnim(0); // Start coroutine if (!animating) { //animating = true; AddToAnimatedList(); //StartCoroutine(AnimationPump()); } } else { // Make sure we are no longer in the animation pump: PauseAnim(); // Since this is a single-frame anim, // call our delegate before setting // the frame so that our behavior is // consistent with multi-frame anims: if (animCompleteDelegate != null) animCompleteDelegate(this); StepAnim(0); } }
/// <summary> /// Like PlayAnim, but plays the animation in reverse. /// See <see cref="PlayAnim"/>. /// </summary> /// <param name="anim">Reference to the animation to play in reverse.</param> public void PlayAnimInReverse(UVAnimation_Multi anim) { curAnim = anim; curAnim.Reset(); curAnim.PlayInReverse(); // Ensure the framerate is not 0 so we don't // divide by zero: anim.framerate = Mathf.Max(0.0001f, anim.framerate); timeBetweenAnimFrames = 1f / anim.framerate; timeSinceLastFrame = timeBetweenAnimFrames; // Only add to the animated list if // the animation has more than 1 frame: if (anim.GetFrameCount() > 1) { StepAnim(0); // Start coroutine if (!animating) { //animating = true; AddToAnimatedList(); //StartCoroutine(AnimationPump()); } } else { // Since this is a single-frame anim, // call our delegate before setting // the frame so that our behavior is // consistent with multi-frame anims: if (animCompleteDelegate != null) animCompleteDelegate(this); StepAnim(0); } }