Ejemplo n.º 1
0
        void CheckAnimatorState()
        {
            for (int i = 0; i < animatorStateSettings.Count; ++i)
            {
                AnimatorStateInfo info = animatorStateSettings[i].animator.GetCurrentAnimatorStateInfo(0);

                if (info.fullPathHash != animatorStateSettings[i].lastAnimatorStateFullPathHash)
                {
                    bool found = false;
                    if (info.IsName(animatorStateSettings[i].stateName))
                    {
                        if (animatorStateSettings[i].disableCharacterController)
                        {
                            m_RigidbodyCharacterController.SetInputEnabled(false);
                        }
                        else
                        {
                            m_RigidbodyCharacterController.SetInputEnabled(true);
                        }

                        found = true;
                        break;
                    }

                    if (!found)
                    {
                        m_RigidbodyCharacterController.SetInputEnabled(true);
                    }

                    animatorStateSettings[i].lastAnimatorStateFullPathHash = info.fullPathHash;
                }
            }
        }