当前位置: 首页>>代码示例>>C#>>正文


C# Animation.Stop方法代码示例

本文整理汇总了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();
	}
开发者ID:IntensiveGoat,项目名称:GoatFootball,代码行数:29,代码来源:PlayerController.cs

示例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);
	}
开发者ID:UpdateShu,项目名称:ForceFury_Unity5,代码行数:9,代码来源:SkillStunGrenadeView.cs

示例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;
 }
开发者ID:AwayCC,项目名称:GD_FINAL,代码行数:9,代码来源:MinionMoving.cs

示例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();
     }
 }
开发者ID:SamOatesUniversity,项目名称:Year-3---Group-Project---Flicker,代码行数:10,代码来源:CSceneObjectPlatform.cs

示例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);
            }
        }
    }
开发者ID:quiker,项目名称:hexagon,代码行数:17,代码来源:ActiveAnimation.cs

示例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";

    }
开发者ID:batnom,项目名称:Boxing-Mate,代码行数:19,代码来源:FightManager.cs

示例7: Start

 // Use this for initialization
 protected override void Start()
 {
     base.AttackSpeed = 10.0f;
     ani = this.GetComponent<Animation>();
     ani.Stop();
     //  animation.animation.Stop();
 }
开发者ID:rohunb,项目名称:Cruel_Blood,代码行数:8,代码来源:Spear.cs

示例8: Start

	void Start () {
        ani = GetComponent<Animation>();
        //ani.Play("letsCreate0");
        ani.Stop();
        
	}
开发者ID:scortez85,项目名称:Ultimate-Apocalypse,代码行数:6,代码来源:printAni.cs

示例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;
    }
开发者ID:friuns,项目名称:New-Unity-Project-diablo,代码行数:27,代码来源:Zombie.cs

示例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;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:63,代码来源:clsurgutils.cs

示例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();
 }
开发者ID:AwayCC,项目名称:GD_FINAL,代码行数:12,代码来源:MinionMoving.cs

示例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++;
            }
        }
开发者ID:DMWR,项目名称:Unity-Boilerplate,代码行数:31,代码来源:SkinnedMeshTemplate.cs

示例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 );
    }
开发者ID:k-lock,项目名称:Unity3D,代码行数:59,代码来源:AnimaTester.cs


注:本文中的UnityEngine.Animation.Stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。