示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        //获取当前动画状态
        AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0);

        if (info.fullPathHash == Animator.StringToHash("Base Layer.Attack") && !animator.IsInTransition(0))
        {
            //判断进入碰撞器的是不是玩家
            if (other.gameObject.tag == "Player")
            {
                mPlayer.OnDamage(1);
                //Debug.Log("碰到了");
            }
        }
    }