//---------------------------------------------------------------------
        // Public
        //---------------------------------------------------------------------

        public virtual void Response(StateAndParameters data)
        {
#if UNITY_EDITOR
            Debug.Log(animatorBinder.name + " with State " + data);
#endif
            response.Invoke(data);
        }
 public void OnExitState(StateAndParameters data)
 {
     if (CurrentState == data)
     {
         CurrentState = null;
     }
 }
        public void UpdateAnimStates(StateAndParameters animationToUse)
        {
            var profile = animationProfile.AllAnimations;

            for (int i = 0; i < profile.Count; i++)
            {
                if (profile[i].parameter == animationToUse)
                {
                    currentAnimation = profile[i].enumOfAnimation;
                    if (!isLocked)
                    {
                        isLocked = profile[i].LockAnimation;
                    }

                    changeAnimatorComponent.TryChangeState(profile[i].parameter);
                    return;
                }
            }
        }
        public virtual void TryChangeState(StateAndParameters nextState)
        {
            if (!isAllowingTransitionToSelf && CurrentState == nextState)
            {
#if UNITY_EDITOR
                Debug.LogWarning(name + " is already in : " + nextState.name);
#endif
                return;
            }

            // Allow transition to itself, but ignore first n-self-transitions
            if (CurrentState == nextState && CurrentNumberOfIgnores > 0)
            {
#if UNITY_EDITOR
                Debug.LogWarning("Ignoring first n self transitions " + CurrentNumberOfIgnores);
#endif
                CurrentNumberOfIgnores--;
                return;
            }

            SetAllParamsFromState(animatorForStateController, nextState);
        }
        public void Raise(StateAndParameters data)
        {
            if (data == null)
            {
                Debug.LogError(" Raising empty Data! ");
                return;
            }

            for (var i = 0; i < listeners.Count; i++)
            {
#if UNITY_EDITOR
                try
                {
                    if (listeners[i] != null)
                    {
                        listeners[i].Response(data);
                    }
                    else
                    {
                        Debug.LogError(" listener is null when data " + data.name);
                    }
                }
                catch (Exception e)
                {
                    if (listeners[i] == null)
                    {
                        Debug.LogError(" listener is null when data " + data.name + " and it caused exception");
                    }
                    else
                    {
                        Debug.LogError(listeners[i].name + " with " + data.name + " caused exception");
                    }
                    throw e;
                }
#else
                listeners[i].Response(data);
#endif
            }
        }
 public void OnEnterState(StateAndParameters data)
 {
     CurrentState = data;
     onStateChanged?.Invoke(CurrentState);
 }