public void SetState(UIStateScriptable state, bool isActive = true)
        {
            _proc = state.Hash;
            int index = _states.IndexOf(IsEqual);

            if (index < 0)
            {
                _states.Add(new RuntimeState()
                {
                    Scriptable = state, Layer = NotSharedLayer, Active = isActive
                });
                return;
            }
            _layer = _states[index].Layer;
            _states.ForEach(DisableIfNecessary);
            _states[index].Active = isActive;
        }
        public void RegisterState(UIStateScriptable state, int layer = NotSharedLayer)
        {
            _proc = state.Hash;
            int index = _states.IndexOf(IsEqual);

            if (index < 0)
            {
                _states.Add(new RuntimeState()
                {
                    Scriptable = state, Layer = layer, Active = false
                });
            }
            else if (layer >= 0)
            {
                _states[index].Layer = layer;
            }
        }
 public bool IsStateActive(UIStateScriptable state)
 {
     _proc = state.Hash;
     return(_states.Any(IsActive));
 }