本文整理汇总了C#中UnityEngine.Animation.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.Stop方法的具体用法?C# Animation.Stop怎么用?C# Animation.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Animation
的用法示例。
在下文中一共展示了Animation.Stop方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
anim = GetComponentInChildren<Animation>();
//Loop all animations
anim.wrapMode = WrapMode.Loop;
//Dont loop the animations below
anim["ramAttack"].wrapMode = WrapMode.Once;
anim["getHit"].wrapMode = WrapMode.Once;
anim["death"].wrapMode = WrapMode.Once;
anim["angry1"].wrapMode = WrapMode.Once;
anim["angry2"].wrapMode = WrapMode.Once;
// Put idle and walk into lower layers (The default layer is always 0)
// This will do two things
// - Since the others and idle/walk are in different layers they will not affect
// each other's playback when calling CrossFade.
// - Since the other is in a higher layer, the animation will replace idle/walk
// animations when faded in.
anim["ramAttack"].layer = 1;
anim["getHit"].layer = 1;
anim["death"].layer = 1;
anim["angry1"].layer = 1;
anim["angry2"].layer = 1;
// Stop animations that are already playing
//(In case user forgot to disable play automatically)
anim.Stop();
}
示例2: Awake
public void Awake() {
_cachedTransform = transform;
_animation = gameObject.GetComponent<Animation>();
_animation.Stop();
EventsAggregator.Fight.AddListener(EFightEvent.MapComplete, OnMapEnd);
EventsAggregator.Fight.AddListener(EFightEvent.MapFail, OnMapEnd);
}
示例3: OnCollisionAffected
void OnCollisionAffected(Collision col)
{
//Debug.Log("Collision Happened");
isCollided = true;
m_Running = GetComponent<Animation>();
m_Running.Stop();
m_Rigidbody = GetComponent<Rigidbody>();
m_Rigidbody.isKinematic = true;
}
示例4: Start
// Use this for initialization
void Start()
{
platAnim = gameObject.GetComponent<Animation>();
m_lastRotY = gameObject.transform.rotation.eulerAngles.y;
if (!m_enabled && platAnim != null)
{
platAnim.Stop();
}
}
示例5: Reset
/// <summary>
/// Manually reset the active animation to the beginning.
/// </summary>
public static void Reset(Animation anim)
{
if (anim.isPlaying)
{
AnimationClip clip = anim.clip;
if (clip != null)
{
anim.Stop();
ActiveAnimation aa = anim.gameObject.GetComponent<ActiveAnimation>();
if (aa != null) Play(anim, clip.name, aa.mLastDirection);
}
}
}
示例6: Awake
void Awake ()
{
// init objects
anim = fighter.GetComponent<Animation>();
anim.wrapMode = WrapMode.Loop;
anim.Stop();
// inits
count = 0;
fighting = 0;
finishedTimer = 0f;
attackMoveArray = new ArrayList();
idlename = "Idle1";
guardname = "Guard";
}
示例7: Start
// Use this for initialization
protected override void Start()
{
base.AttackSpeed = 10.0f;
ani = this.GetComponent<Animation>();
ani.Stop();
// animation.animation.Stop();
}
示例8: Start
void Start () {
ani = GetComponent<Animation>();
//ani.Play("letsCreate0");
ani.Stop();
}
示例9: InitModel
private void InitModel()
{
//foreach (var a in GetComponentsInChildren<CapsuleCollider>())
//{
// var caps = a as CapsuleCollider;
// if (caps !=null)
// {
// var box = caps.gameObject.AddComponent<BoxCollider>();
// box.center = caps.center;
// box.size = new Vector3(caps.radius, caps.height, caps.radius);
// Destroy(caps);
// }
//}
maxlife = life;
_Game.zombies.Add(this);
anim = GetComponentInChildren<Animation>();
anim.playAutomatically = false;
anim.Stop();
model = anim.transform;
deadMaterial = GetComponentInChildren<DeadMaterial>();
if (model.GetComponent<Forward>() == null)
model.gameObject.AddComponent<Forward>().receiver = transform;
foreach (var a in rigidBodies)
a.angularDrag = 2;
}
示例10: metcrossfadetransitionanimation
public static int metcrossfadetransitionanimation(Transform varpcharacter, string varpdestinationanimname, float varptransitiontime, Transform varpcontroller = null, string varpstateanimationname = "", bool varpgokinematic = true, string varpnewanimname = "transition", Animation varpanimationsystem = null, SkinnedMeshRenderer varprenderer = null, clsurganimationstatesmanager varpstatesmanager = null)
{
if (varpcharacter == null)
{
return -1;
}
if (varptransitiontime == 0f)
{
return -2;
}
if (varpanimationsystem == null)
{
varpanimationsystem = varpcharacter.root.GetComponentInChildren<Animation>();
if (varpanimationsystem == null)
{
return -3;
}
varpanimationsystem.Stop();
}
if (varprenderer == null)
{
varprenderer = varpcharacter.root.GetComponentInChildren<SkinnedMeshRenderer>();
if (varprenderer == null)
{
return -4;
}
}
if (varpgokinematic)
{
clsurgutils.metgodriven(varpcharacter, true);
}
Vector3 localPosition = default(Vector3);
if (varpcontroller != null)
{
Vector3 position = varpcharacter.position;
varpcontroller.position = position;
varpcharacter.localPosition = localPosition;
}
AnimationClip animationClip = clsurgutils.metcreatetransitionanimation(varpcharacter, varpdestinationanimname, varptransitiontime, varpnewanimname, ref localPosition, varpstatesmanager, false);
if (animationClip != null)
{
varpanimationsystem.Stop();
AnimationState animationState = varpanimationsystem[varpdestinationanimname];
if (animationState != null && animationState.name != varpdestinationanimname)
{
varpanimationsystem.RemoveClip(varpnewanimname);
}
varpanimationsystem.AddClip(animationClip, varpnewanimname);
if (varpstateanimationname != string.Empty)
{
varpanimationsystem[varpnewanimname].wrapMode = WrapMode.Once;
varpanimationsystem.CrossFade(varpnewanimname);
varpanimationsystem.CrossFadeQueued(varpstateanimationname);
}
else
{
varpanimationsystem.CrossFade(varpnewanimname);
}
return 1;
}
Debug.LogError("Could not create transition");
return -5;
}
示例11: OnCollisionEnter
void OnCollisionEnter(Collision col)
{
//Debug.Log("Collision Happened");
isCollided = true;
m_Running = GetComponent<Animation>();
m_Running.Stop();
m_Rigidbody = GetComponent<Rigidbody>();
m_Rigidbody.isKinematic = true;
for (int u = 0; u < 4; u++)
if(m_group[u]!=this)
m_group[u].stop();
}
示例12: BakeSkinnedMesh
private void BakeSkinnedMesh(Animation animation, SkinnedMeshRenderer skinnedMeshRenderer)
{
int clipIndex = 0;
foreach (AnimationState clipState in animation)
{
//Prep animation clip for sampling
var curClip = this.AnimationClipsToBake[clipIndex] = animation.GetClip(clipState.name);
animation.Play(clipState.name, PlayMode.StopAll);
clipState.time = 0;
clipState.wrapMode = WrapMode.Clamp;
//Calculate number of meshes to bake in this clip sequence based on the clip's sampling framerate
uint numberOfFrames = (uint)Mathf.RoundToInt(curClip.frameRate * curClip.length);
var curBakedMeshSequence = this.BakedClips[clipIndex] = new MeshSequence(numberOfFrames);
for (uint frameIndex = 0; frameIndex < numberOfFrames; frameIndex++)
{
//Bake sequence of meshes
var curMeshFrame = curBakedMeshSequence[frameIndex] = new Mesh();
curMeshFrame.name = string.Format(@"{0}_Baked_{1}_{2}", this.name, clipIndex, frameIndex);
animation.Sample();
skinnedMeshRenderer.BakeMesh(curMeshFrame);
clipState.time += (1.0f / curClip.frameRate);
}
animation.Stop();
clipIndex++;
}
}
示例13: Start
void Start()
{
animator = skater.gameObject.GetComponent<Animation>();
animator.wrapMode = WrapMode.Clamp;
animator["idle"].wrapMode = WrapMode.Once;
animator["idle"].layer = -1;
animator["idle2push"].wrapMode = WrapMode.Clamp;
animator["idle2push"].layer = -1;
animator["idlePush"].wrapMode = WrapMode.Clamp;
animator["idlePush"].layer = -1;
animator["push2idle"].wrapMode = WrapMode.Clamp;
animator["push2idle"].layer = -1;
animator["fakie"].wrapMode = WrapMode.Once;
animator["fakie"].layer = -1;
animator["fakie2push"].wrapMode = WrapMode.Clamp;
animator["fakie2push"].layer = -1;
animator["fakiePush"].wrapMode = WrapMode.Clamp;
animator["fakiePush"].layer = -1;
animator["push2fakie"].wrapMode = WrapMode.Clamp;
animator["push2fakie"].layer = -1;
animator["idle_TrickPosition"].wrapMode = WrapMode.Clamp;
animator["idle_TrickPosition"].layer = -1;
animator["fakie_TrickPosition"].wrapMode = WrapMode.Clamp;
animator["fakie_TrickPosition"].layer = -1;
animator["idle_bremsenIn"].wrapMode = WrapMode.Once;
animator["idle_bremsenIn"].layer = -1;
animator["idle_bremsenOut"].wrapMode = WrapMode.Once;
animator["idle_bremsenOut"].layer = -1;
animator["idle_HeelFlip"].wrapMode = WrapMode.Clamp;
animator["idle_KickFlip"].wrapMode = WrapMode.Clamp;
animator["idle_Ollie"].wrapMode = WrapMode.Clamp;
animator["idle_Varial_In"].wrapMode = WrapMode.Clamp;
animator["idle_Varial_Out"].wrapMode = WrapMode.Clamp;
animator["fakie_HeelFlip"].wrapMode = WrapMode.Clamp;
animator["fakie_KickFlip"].wrapMode = WrapMode.Clamp;
animator["fakie_Ollie"].wrapMode = WrapMode.Clamp;
animator["fakie_Varial_In"].wrapMode = WrapMode.Clamp;
animator["fakie_Varial_Out"].wrapMode = WrapMode.Clamp;
//animator.SyncLayer(-1);
animator.Stop( );
//PlayClip( 0 );
}