public void AddState <T>(StableAnimationState state, T controller) where T : AnimationControllerBase
        {
            if (_stateLookup.ContainsKey(state))
            {
                throw new ArgumentException("Controller for state " + state + " already added.");
            }

            _stateLookup.Add(state, controller);
            _typeLookup.Add(typeof(T), controller);
        }
        public bool ChangeState(StableAnimationState state)
        {
            if (_isLocked)
            {
                return(false);
            }

            if (state == ActiveState && ActiveController != null)
            {
                return(false);
            }

            var newController = _stateLookup[state];

            if (ActiveController != null)
            {
                ActiveController.Disable();
            }

            if (SwitchingFromSidewaysToFrontFacingAnimation(ActiveController, newController))
            {
                ResetSkeleton();
            }

            ActiveController = newController;
            ActiveController.Enable();

            if (ActiveController.LocksStateMachine)
            {
                _isLocked = true;
            }

            ActiveState = state;

            return(true);
        }