// Add listeners to the OnStateActivated and OnStateDeactivated events
        private void AddStateEventListeners()
        {
            // Add listeners to invoke a state event.
            OnStateActivated.AddListener((state) =>
            {
                // If the event configuration for a state is of type StateEvents, this means that the state
                // does not have associated dynamic event data. Therefore, the state event can be invoked when
                // the state value changes without passing in event data.
                if (state.EventConfiguration is StateEvents)
                {
                    EventReceiverManager.InvokeStateEvent(state.Name);
                }
            });

            OnStateDeactivated.AddListener((previousState, currentState) =>
            {
                if (previousState.EventConfiguration is StateEvents)
                {
                    EventReceiverManager.InvokeStateEvent(previousState.Name);
                }
            });
        }
        /// <summary>
        /// Gets and sets a state to On and invokes the OnStateActivated event. Setting a
        /// state on changes the state value to 1.
        /// </summary>
        /// <param name="stateName">The name of the state to set to on</param>
        /// <returns>The state that was set to on</returns>
        public InteractionState SetStateOn(string stateName)
        {
            InteractionState state = GetState(stateName);

            if (state != null)
            {
                // Only update the state value and invoke events if InteractiveElement is Active
                if (state.Value != 1 && InteractiveElement.Active)
                {
                    state.Value  = 1;
                    state.Active = true;

                    OnStateActivated.Invoke(state);

                    // Only add the state to activeStates if it is not present
                    if (!activeStates.Contains(state))
                    {
                        activeStates.Add(state);
                    }

                    InteractionState defaultState = GetState(defaultStateName);

                    // If the state getting switched on and is NOT the default state, then make sure the default state is off
                    // The default state is only active when ALL other states are not active
                    if (state.Name != defaultStateName && defaultState.Active)
                    {
                        SetStateOff(defaultStateName);
                    }
                }
            }
            else
            {
                Debug.LogError($"The {stateName} state is not being tracked, add this state using AddState(state) to set it");
            }

            return(state);
        }