コード例 #1
0
    void LateUpdate()
    {
        // Update animator
        if (IsAlive())
        {
            m_Animator.SetFloat("ForwardSpeed", Mathf.Abs(m_Controller.GetInputVec().x));
            if (Mathf.Abs(m_Controller.GetInputVec().x) > Mathf.Epsilon && m_Controller.IsGrounded() && !m_Controller.isAttacking)
            {
                m_Animator.speed = Mathf.Max(Mathf.Abs(m_Controller.GetInputVec().x), 0.5f);
            }

            m_Animator.SetFloat("Combat", m_Target ? 1 : 0);

            m_Animator.SetBool("IsFlinching", m_Controller.IsFlinching());

            // Needed to properly exit attack animations
            m_Animator.SetBool("IsAttacking", m_Controller.isAttacking);
        }

        m_Animator.SetBool("Grounded", m_Controller.IsGrounded());
    }