本文整理汇总了C#中Animation.Sample方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.Sample方法的具体用法?C# Animation.Sample怎么用?C# Animation.Sample使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation.Sample方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayAnimation
/// <summary>
/// 播放动画片段
/// </summary>
/// <param name="anim"></param>
/// <param name="name"></param>
/// <param name="dir"></param>
/// <returns></returns>
public static AnimationState PlayAnimation(Animation anim, string name, AnimationOrTween.Direction dir)
{
var state = anim[name];
if (state)
{
float speed = Mathf.Abs(state.speed);
state.speed = speed * (int)dir;
if (dir == AnimationOrTween.Direction.Reverse && state.time == 0f) state.time = state.length;
else if (dir == AnimationOrTween.Direction.Forward && state.time == state.length) state.time = 0f;
//Debug.Log(string.Format(" speed {0},dir ={1},time = {2},length={3}",state.speed,dir,state.time,state.length));
anim.Play(name);
anim.Sample();
}
return state;
}