本文整理汇总了C#中Part.FindModelAnimators方法的典型用法代码示例。如果您正苦于以下问题:C# Part.FindModelAnimators方法的具体用法?C# Part.FindModelAnimators怎么用?C# Part.FindModelAnimators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.FindModelAnimators方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: playAnimationSetToPosition
public static void playAnimationSetToPosition(Part p, string animationName, float position)
{
Animation anim;
anim = p.FindModelAnimators(animationName).FirstOrDefault();
if (anim != null) {
anim[animationName].normalizedTime = position;
anim[animationName].speed = 0f;
anim.Play(animationName);
// anim [animationName].speed = 0;
}
}
示例2: SetUpAnimation
//Thanks Majiir!
public static AnimationState[] SetUpAnimation(string animationName, Part part)
{
var states = new List<AnimationState>();
foreach (var animation in part.FindModelAnimators(animationName))
{
var animationState = animation[animationName];
animationState.speed = 0;
animationState.enabled = true;
animationState.wrapMode = WrapMode.ClampForever;
animation.Blend(animationName);
states.Add(animationState);
}
return states.ToArray();
}
示例3: SetUpSingleAnimation
public static AnimationState SetUpSingleAnimation(string animationName, Part part)
{
var states = new List<AnimationState>();
foreach (var animation in part.FindModelAnimators(animationName))
{
var animationState = animation[animationName];
animationState.speed = 0;
animationState.enabled = true;
animationState.wrapMode = WrapMode.ClampForever;
animation.Blend(animationName);
return animationState;
}
return null;
}
示例4: playAnimation
public static void playAnimation(Part p, string animationName, bool forward, bool play, float speed)
{
Animation anim;
anim = p.FindModelAnimators(animationName).FirstOrDefault();
if (anim != null) {
if (forward) {
anim[animationName].speed = 1f * speed;
//PartModule.print ("NTime forward: " + anim [animationName].normalizedTime);
if (!play || !anim.isPlaying)
anim[animationName].normalizedTime = (play ? 0f : 1f);
anim.Blend(animationName, 2f);
}
else {
anim[animationName].speed = -1f * speed;
//PartModule.print ("NTime backward: " + anim [animationName].normalizedTime);
if (!play || !anim.isPlaying)
anim[animationName].normalizedTime = (play ? 1f : 0f);
anim.Blend(animationName, 2f);
}
}
}
示例5: SetUpAnimation
// This function loads up some animationstates
public static AnimationState[] SetUpAnimation(string animationName, Part part)
{
var states = new List<AnimationState>();
int layer = 0;
foreach (var animation in part.FindModelAnimators(animationName))
{
var animationState = animation[animationName];
animationState.speed = 0;
animationState.enabled = true;
// Clamp this or else weird things happen
animationState.wrapMode = WrapMode.ClampForever;
animation.Blend(animationName);
animationState.blendMode = AnimationBlendMode.Additive;
// animationState.layer = layer;
states.Add(animationState);
layer++;
}
// Convert
return states.ToArray();
}