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


C# Animator.GetCurrentAnimatorStateInfo方法代码示例

本文整理汇总了C#中UnityEngine.Animator.GetCurrentAnimatorStateInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.GetCurrentAnimatorStateInfo方法的具体用法?C# Animator.GetCurrentAnimatorStateInfo怎么用?C# Animator.GetCurrentAnimatorStateInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Animator的用法示例。


在下文中一共展示了Animator.GetCurrentAnimatorStateInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WaitForAnimation

    private IEnumerator WaitForAnimation(Animator animator)
    {
        do
        {
            yield return null;
        } while (animator.GetCurrentAnimatorStateInfo(0).IsName("Armature|Victory") || animator.GetCurrentAnimatorStateInfo(0).IsName("Armature|Victory0") || animator.IsInTransition(0));

        laser.SetActive(true);
    }
开发者ID:JoaoLReis,项目名称:Summer_2014_TD,代码行数:9,代码来源:RelayBehaviour.cs

示例2: CacheAnimState

    /// <summary>
    /// cache animator states and their data
    /// </summary>
    public static void CacheAnimState(Animator anim, out int[] animStateNames, out float[] animStateTimes)
    {
        animStateNames = new int[anim.layerCount];
        animStateTimes = new float[anim.layerCount];

        for (int i = 0; i < anim.layerCount; i++)
        {
            animStateNames[i] = anim.GetCurrentAnimatorStateInfo(i).fullPathHash;
            animStateTimes[i] = anim.GetCurrentAnimatorStateInfo(i).normalizedTime;
        }
    }
开发者ID:slayer3600,项目名称:sproj,代码行数:14,代码来源:AnimatorCullingUtility.cs

示例3: CheckIsInState

 /// <summary>
 // Checks if the animator is in a specified state on any of its layers, and
 // returns the state info.
 /// </summary>
 /// <returns><c>true</c>, if in the state, <c>false</c> otherwise.</returns>
 /// <param name="animator">Animator.</param>
 /// <param name="stateName">State name.</param>
 /// <param name="animatorStateInfo">(Out) Animator state info.</param>
 private bool CheckIsInState(Animator animator, string stateName, out AnimatorStateInfo animatorStateInfo)
 {
     if (animator != null) {
         for (int layerIndex = 0; layerIndex < animator.layerCount; layerIndex++) {
             AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(layerIndex);
             if (info.IsName(stateName)) {
                 animatorStateInfo = info;
                 return true;
             }
         }
     }
     animatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
     return false;
 }
开发者ID:farreltr,项目名称:OneLastSunset,代码行数:22,代码来源:SequencerCommandAnimatorPlayWait.cs

示例4: Start

 // Use this for initialization
 void Start()
 {
     material = GetComponentInChildren<Renderer>().materials[qualMaterial];
     animator = GetComponent<Animator>();
     if(animator)
         animaState = animator.GetCurrentAnimatorStateInfo(0);
 }
开发者ID:fayvit,项目名称:PQP,代码行数:8,代码来源:piscar.cs

示例5: Update

    // Update is called once per frame
    void Update()
    {
        tempo+=Time.deltaTime;

        if(animator)
        {
            animaState = animator.GetCurrentAnimatorStateInfo(0);
            if(animaState.IsName("padrao")){
                if(tempo>TEMPO_DE_PISCAR )
                {
                    piscarAgora();
                }
            }else if(animaState.IsName("cair")){
                material.mainTextureOffset = new Vector3(3*deslocamento,0);
            }else if(animaState.IsName("dano1")){
                tempo = TEMPO_DE_PISCAR;
                piscarAgora();
            }else
                material.mainTextureOffset = new Vector3(0,0);
        }else
        {
            animator = GetComponent<Animator>();
            if(animator)
                animaState = animator.GetCurrentAnimatorStateInfo(0);
        }
    }
开发者ID:fayvit,项目名称:PQP,代码行数:27,代码来源:piscar.cs

示例6: WallJump

    public void WallJump(Animator myAnimator, Rigidbody2D myRigidbody2D, WallCheck[] allWallChecks)
    {
        if(!lockWallJump)
        {
            foreach(WallCheck localWallCheck in allWallChecks)
            {
                if(localWallCheck.walled)
                {
                    lockWallJump = true;
                    if(myRigidbody2D.transform.localScale.x < 0)
                    {
                        myRigidbody2D.AddForce(new Vector2(myRigidbody2D.velocity.x + jumpForce.x, jumpForce.y));
                    }
                    else
                    {
                        myRigidbody2D.AddForce(new Vector2(myRigidbody2D.velocity.x - jumpForce.x, jumpForce.y));
                    }

                    if(!myAnimator.GetCurrentAnimatorStateInfo(0).IsName(jumpAnimationName))
                    {
                        myAnimator.SetTrigger(jumpAnimationTriggerName);
                    }
                    Invoke ("UnlockWallJump", lockTime);
                    break;
                }
            }
        }
    }
开发者ID:Dunmord,项目名称:UnityMegamanX,代码行数:28,代码来源:WallJump2D.cs

示例7: Start

 //private float _seed = 0.0f;
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator> ();
     currentState = anim.GetCurrentAnimatorStateInfo (0);
     previousState = currentState;
     StartCoroutine ("RandomChange");
 }
开发者ID:JMRisinger,项目名称:AR1,代码行数:9,代码来源:IdleChanger.cs

示例8: Start

 // Use this for initialization
 void Start()
 {
     // 各参照の初期化
     anim = GetComponent<Animator> ();
     currentState = anim.GetCurrentAnimatorStateInfo (0);
     previousState = currentState;
 }
开发者ID:godenzzm,项目名称:ActionGameDemo,代码行数:8,代码来源:IdleChanger.cs

示例9: AnimatorHelper

	public AnimatorHelper (Animator a)
	{
		animator = a;
		currentState_ = animator.GetCurrentAnimatorStateInfo (0);

		RefreshSubAnimators ();
	}
开发者ID:siwenRen,项目名称:Wolf,代码行数:7,代码来源:AnimatorHelper.cs

示例10: Awake

 private void Awake()
 {
     action = playerAction.normal;
     anim = GetComponent<Animator>();
     attackColl = GameObject.Find(PathHelper.playerAttackColliderPath).GetComponent<SphereCollider>();
     stateInfo = anim.GetCurrentAnimatorStateInfo(0);
     characterController = GetComponent<CharacterController>();
 }
开发者ID:kabuki0111,项目名称:HideAndSeekGame,代码行数:8,代码来源:PlayerController.cs

示例11: IsDone

 public static bool IsDone(Animator anim, int loopCount = 1)
 {
     if (anim)
     {
         return anim.GetCurrentAnimatorStateInfo(Default_Layer).normalizedTime >= (float)loopCount;
     }
     return true;
 }
开发者ID:Ankk4,项目名称:highlyresponsive-forever,代码行数:8,代码来源:AnimatorWrapper.cs

示例12: IsStateActive

 /// <summary>
 /// Returns true when the current state is active.
 /// </summary>
 /// <param name="name">name of state</param>
 /// <param name="animator">animator object</param>
 /// <returns></returns>
 public static bool IsStateActive(string name, Animator animator)
 {
     for (int i = 0; i < animator.layerCount; i++)
     {
         if (animator.GetCurrentAnimatorStateInfo(i).IsName(name)) return true;
     }
     return false;
 }
开发者ID:jaymaycry,项目名称:jaynik2drpg,代码行数:14,代码来源:Utilities.cs

示例13: IsName

 public static bool IsName(Animator anim,string name)
 {
     if (anim)
     {
         return anim.GetCurrentAnimatorStateInfo(Default_Layer).IsName(name);
     }
     return false;
 }
开发者ID:Ankk4,项目名称:highlyresponsive-forever,代码行数:8,代码来源:AnimatorWrapper.cs

示例14: OnStateExit

	override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) 
	{
		if(animator.GetCurrentAnimatorStateInfo(0).fullPathHash == AnimationIDs.IDLE_STATE)
		{
			PlayerMovement playerMovement = animator.gameObject.GetComponent<PlayerMovement>();
			playerMovement.MoveLocked = false;
			playerMovement.ForceAim = false;
		}
	}
开发者ID:TGolias,项目名称:St.-Anger,代码行数:9,代码来源:RemovePlayerMovelock.cs

示例15: Start

		// Use this for initialization
		void Start ()
		{
			// 各参照の初期化
			anim = GetComponent<Animator> ();
			currentState = anim.GetCurrentAnimatorStateInfo (0);
			previousState = currentState;
			// ランダム判定用関数をスタートする
			StartCoroutine ("RandomChange");
		}
开发者ID:Mattys410305,项目名称:Magical-Girl-Shop,代码行数:10,代码来源:IdleChanger.cs


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