本文整理汇总了C#中UVAnimation.GetFrameCount方法的典型用法代码示例。如果您正苦于以下问题:C# UVAnimation.GetFrameCount方法的具体用法?C# UVAnimation.GetFrameCount怎么用?C# UVAnimation.GetFrameCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UVAnimation
的用法示例。
在下文中一共展示了UVAnimation.GetFrameCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayAnimInReverse
/// <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);
}
}
示例2: PlayAnimInReverse
/// <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);
}
}
示例3: PlayAnim
/// <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);
}
}
示例4: PlayAnim
/// <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);
}
}