当前位置: 首页>>代码示例>>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;未经允许,请勿转载。