當前位置: 首頁>>代碼示例>>C#>>正文


C# Animator.GetComponentInParent方法代碼示例

本文整理匯總了C#中Animator.GetComponentInParent方法的典型用法代碼示例。如果您正苦於以下問題:C# Animator.GetComponentInParent方法的具體用法?C# Animator.GetComponentInParent怎麽用?C# Animator.GetComponentInParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Animator的用法示例。


在下文中一共展示了Animator.GetComponentInParent方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnStateExit

 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.GetComponentInParent<Character>().Status == Character.Statuses.ATTACKING)
     {
         animator.GetComponentInParent<Character>().Status = Character.Statuses.READY;
     }
 }
開發者ID:eduardolm87,項目名稱:ncrffce2,代碼行數:16,代碼來源:AnimEndAttack.cs

示例2: OnStateEnter

 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Debug.Log("Stop");
     var rigidbody = animator.GetComponentInParent<Rigidbody>();
     store = rigidbody.constraints;
     rigidbody.constraints = RigidbodyConstraints.FreezeAll;
 }
開發者ID:bergerbo,項目名稱:ggj2016,代碼行數:8,代碼來源:StopVelocity.cs

示例3: OnStateEnter

 // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (stateInfo.IsTag("DestroyState"))
     {
         animator.GetComponentInParent<BaseEnemy>().DestroyEnemy(stateInfo.length);
     }
 }
開發者ID:uxtuno,項目名稱:SilverShip,代碼行數:8,代碼來源:EnemyAnimatorBehaviour.cs

示例4: OnStateUpdate

    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(animator.GetBool("Grounded"))
        {
            UnityEngine.Random rnd = new UnityEngine.Random();
            //animator.GetComponentInParent<Rigidbody>().AddForce(new Vector3(rnd.RandomRange(-1.0f, 1.0f), rnd.RandomRange(-20.0f, 20.0f), rnd.RandomRange(-1.0f, 1.0f));
            animator.GetComponentInParent<Rigidbody>().AddForce(new Vector3(0f, 20f, 0f));
            animator.SetBool("Grounded", false);
        }
    }
開發者ID:Midimistro,項目名稱:Deadmen,代碼行數:16,代碼來源:ItemRebounce.cs

示例5: OnStateEnter

 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     //animator.transform.parent.GetComponent<Actor>();
     m_Actor = animator.GetComponentInParent<Actor>();
     if(m_Actor.AI.CURRENT_AI_STATE == eAIStateType.AI_STATE_ATTACK)
     {
         m_Actor.AI.IS_ATTACK = true;
         m_bIsAttack = false;
     }
 }
開發者ID:yunhoyong,項目名稱:test,代碼行數:10,代碼來源:AttackAnimation.cs

示例6: OnStateEnter

    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        _playerCollider2D = animator.GetComponentsInParent<Collider2D>();
        for (int i = 0; i < _playerCollider2D.Length; i++) {
            _playerCollider2D[i].enabled = false;
        }

        if (DisableGravity) {
            _playerRigidBody2D = animator.GetComponentInParent<Rigidbody2D>();
            _gravitySaved = _playerRigidBody2D.gravityScale;
            _playerRigidBody2D.gravityScale = 0.0f;

            _velocitySaved = _playerRigidBody2D.velocity;
            _playerRigidBody2D.velocity = Vector2.zero;
        }
    }
開發者ID:SpoonmanGames,項目名稱:Descend-Into-Heaven,代碼行數:17,代碼來源:DisableCollitionsBehaviour.cs

示例7: OnStateExit

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        var rigidbody = animator.GetComponentInParent<Rigidbody>();
        rigidbody.constraints = store;

    }
開發者ID:bergerbo,項目名稱:ggj2016,代碼行數:12,代碼來源:StopVelocity.cs

示例8: OnStateExit

    //OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //    BossAttack attackScript = animator.GetComponentInParent<BossAttack>();
    //    attackScript.ToggleMeleeCollider();
    //}
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}
    //OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        BossAIScript aiScript = animator.GetComponentInParent<BossAIScript>();

        aiScript.Attacking = false;
    }
開發者ID:xxfinemus,項目名稱:TowerDefenceArena,代碼行數:17,代碼來源:AttackAnimationScript.cs

示例9: OnStateEnter

	// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
	override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
		WalkerController controller = animator.GetComponentInParent<WalkerController> ();
		controller.Died ();
	}
開發者ID:Pepek91,項目名稱:PolyJam2016,代碼行數:5,代碼來源:OfiaraAnimationController.cs

示例10: OnStateEnter

	 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
	override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
		animator.GetComponentInParent<Transform> ().GetComponentInParent<AudioSource> ().Play ();
	}
開發者ID:JonaSilva,項目名稱:cozcyt,代碼行數:5,代碼來源:reproducirAudioSourcers.cs

示例11: OnStateEnter

//	  OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
	override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
		animator.GetComponentInParent<Transform> ().GetComponentInParent<PartyGroup> ().Facing (true);
	}
開發者ID:qwook,項目名稱:PartyRitualGame,代碼行數:4,代碼來源:Facing.cs


注:本文中的Animator.GetComponentInParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。