當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。