public void PlayAnimInReverse(UVAnimation anim, int frame)
 {
     this.curAnim = anim;
     this.curAnim.Reset();
     this.curAnim.PlayInReverse();
     this.curAnim.SetCurrentFrame(frame + 1);
     anim.framerate             = Mathf.Max(0.0001f, anim.framerate);
     this.timeBetweenAnimFrames = 1f / anim.framerate;
     this.timeSinceLastFrame    = this.timeBetweenAnimFrames;
     if (anim.GetFrameCount() > 1)
     {
         this.StepAnim(0f);
         if (!this.animating)
         {
             base.AddToAnimatedList();
         }
     }
     else
     {
         if (this.animCompleteDelegate != null)
         {
             this.animCompleteDelegate(this);
         }
         this.StepAnim(0f);
     }
 }
Beispiel #2
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 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; }

        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);
        }
    }
Beispiel #3
0
    /// <summary>
    /// Starts playing the specified animation
    /// Note: this doesn't resume from a pause,
    /// it completely restarts the animation. To
    /// unpause, use <see cref="UnpauseAnim"/>.
    /// </summary>
    /// <param name="anim">A reference to the animation to play.</param>
    /// <param name="frame">The zero-based index of the frame at which to start playing.</param>
    public void PlayAnim(UVAnimation anim, int frame)
    {
        if (deleted || !gameObject.active)
        {
            return;
        }

        curAnim      = anim;
        curAnimIndex = curAnim.index;
        curAnim.Reset();
        curAnim.SetCurrentFrame(frame - 1);             // curFrame inside UVAnimation will be incremented before it is used, so anticipate this by decrementing by 1

        // 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
        // or the framerate is non-zero:
        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
        {
            // 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);
        }
    }
Beispiel #4
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>
    /// <param name="frame">The zero-based index of the frame at which to start playing.</param>
    public void PlayAnimInReverse(UVAnimation anim, int frame)
    {
#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();
        curAnim.SetCurrentFrame(frame + 1);             // curFrame inside UVAnimation will be decremented before it is used, so anticipate this by decrementing by 1

        // 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);
        }
    }
 public void PlayAnim(UVAnimation anim, int frame)
 {
     if (!this.allwaysPlayAnim && (this.deleted || !base.gameObject.activeInHierarchy))
     {
         return;
     }
     if (!this.m_started)
     {
         this.Start();
     }
     this.curAnim      = anim;
     this.curAnimIndex = this.curAnim.index;
     this.curAnim.Reset();
     this.curAnim.SetCurrentFrame(frame - 1);
     if (anim.framerate != 0f)
     {
         this.timeBetweenAnimFrames = 1f / anim.framerate;
     }
     else
     {
         this.timeBetweenAnimFrames = 1f;
     }
     this.timeSinceLastFrame = this.timeBetweenAnimFrames;
     if ((anim.GetFrameCount() > 1 || anim.onAnimEnd != UVAnimation.ANIM_END_ACTION.Do_Nothing) && anim.framerate != 0f)
     {
         this.StepAnim(0f);
         if (!this.animating)
         {
             base.AddToAnimatedList();
         }
     }
     else
     {
         base.PauseAnim();
         if (this.animCompleteDelegate != null)
         {
             this.animCompleteDelegate(this);
         }
         this.StepAnim(0f);
     }
 }
Beispiel #6
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 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);
        }
    }
 public void PlayAnimInReverse(UVAnimation anim)
 {
     if (this.deleted || !base.gameObject.activeInHierarchy)
     {
         return;
     }
     this.curAnim = anim;
     this.curAnim.Reset();
     this.curAnim.PlayInReverse();
     if (anim.framerate != 0f)
     {
         this.timeBetweenAnimFrames = 1f / anim.framerate;
     }
     else
     {
         this.timeBetweenAnimFrames = 1f;
     }
     this.timeSinceLastFrame = this.timeBetweenAnimFrames;
     if ((anim.GetFrameCount() > 1 || anim.onAnimEnd != UVAnimation.ANIM_END_ACTION.Do_Nothing) && anim.framerate != 0f)
     {
         this.StepAnim(0f);
         if (!this.animating)
         {
             base.AddToAnimatedList();
         }
     }
     else
     {
         base.PauseAnim();
         if (this.animCompleteDelegate != null)
         {
             this.animCompleteDelegate(this);
         }
         this.StepAnim(0f);
     }
 }
	/// <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>
	/// <param name="frame">The zero-based index of the frame at which to start playing.</param>
	public void PlayAnimInReverse(UVAnimation anim, int frame)
	{
#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();
		curAnim.SetCurrentFrame(frame + 1);	// curFrame inside UVAnimation will be decremented before it is used, so anticipate this by decrementing by 1

		// 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 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;

		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>
	/// Starts playing the specified animation
	/// Note: this doesn't resume from a pause,
	/// it completely restarts the animation. To
	/// unpause, use <see cref="UnpauseAnim"/>.
	/// </summary>
	/// <param name="anim">A reference to the animation to play.</param>
	/// <param name="frame">The zero-based index of the frame at which to start playing.</param>
	public void PlayAnim(UVAnimation anim, int frame)
	{
#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;
		curAnimIndex = curAnim.index;
		curAnim.Reset();
		curAnim.SetCurrentFrame(frame - 1);	// curFrame inside UVAnimation will be incremented before it is used, so anticipate this by decrementing by 1

		// 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
		// or the framerate is non-zero:
		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)
			{
				// See if we need to delay calling
				// our delegate to be consistent
				// with our framerate:
				if (anim.framerate != 0)
				{
					Invoke("CallAnimCompleteDelegate", 1f / anim.framerate);
				}
				else
					animCompleteDelegate(this);
			}

			StepAnim(0);
		}
	}
Beispiel #11
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 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);
        }
    }
Beispiel #12
0
    /// <summary>
    /// Starts playing the specified animation
    /// Note: this doesn't resume from a pause,
    /// it completely restarts the animation. To
    /// unpause, use <see cref="UnpauseAnim"/>.
    /// </summary>
    /// <param name="anim">A reference to the animation to play.</param>
    /// <param name="frame">The zero-based index of the frame at which to start playing.</param>
    public void PlayAnim(UVAnimation anim, int frame)
    {
        if (deleted || !gameObject.active)
            return;

        curAnim = anim;
        curAnimIndex = curAnim.index;
        curAnim.Reset();
        curAnim.SetCurrentFrame(frame - 1);	// curFrame inside UVAnimation will be incremented before it is used, so anticipate this by decrementing by 1

        // 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
        // or the framerate is non-zero:
        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
        {
            // 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);
        }
    }
Beispiel #13
0
    /// <summary>
    /// Starts playing the specified animation
    /// Note: this doesn't resume from a pause,
    /// it completely restarts the animation. To
    /// unpause, use <see cref="UnpauseAnim"/>.
    /// </summary>
    /// <param name="anim">A reference to the animation to play.</param>
    /// <param name="frame">The zero-based index of the frame at which to start playing.</param>
    public void PlayAnim(UVAnimation anim, int frame)
    {
#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;
        curAnimIndex = curAnim.index;
        curAnim.Reset();
        curAnim.SetCurrentFrame(frame - 1);             // curFrame inside UVAnimation will be incremented before it is used, so anticipate this by decrementing by 1

        // 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
        // or the framerate is non-zero:
        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)
            {
                // See if we need to delay calling
                // our delegate to be consistent
                // with our framerate:
                if (anim.framerate != 0)
                {
                    Invoke("CallAnimCompleteDelegate", 1f / anim.framerate);
                }
                else
                {
                    animCompleteDelegate(this);
                }
            }

            StepAnim(0);
        }
    }