protected virtual void FixedUpdate() { // check collisions // check the active collisions // ? if (m_activeStackedState != null) { InputManager.Instance.IgnoreInput = m_activeStackedState.ConsumesInputAndEffects; } foreach (ControllerState state in m_activeState.FutureStates) { bool entered = state.EnterOnCondition(/*m_activeState*/); if (entered) { m_activeState.Abort(); state.LogicalEnter(); if (m_activeStackedState == null || !m_activeStackedState.ConsumesInputAndEffects) { state.EffectualEnter(); } //m_lastState = m_activeState; m_stateStartedFrame = GameManager.Instance.Frame; Debug.Log("New active: " + state); m_activeState = state; break; } } if (m_activeStackedState != null) { foreach (ControllerState state in m_activeStackedState.StackedStates) { if (state.EnterOnCondition()) { m_activeStackedState?.Abort(); state.LogicalEnter(); state.EffectualEnter(); m_stateStartedStackedFrame = GameManager.Instance.Frame; m_activeStackedState = state; break; } } } else { //DUNNO; Should the active state be able to still trigger stacked states? //DUNNO; Should I be able to add non stacked states to a stacked state foreach (ControllerState state in m_activeState.StackedStates) { if (state.EnterOnCondition()) { m_activeStackedState?.Abort(); state.LogicalEnter(); state.EffectualEnter(); m_stateStartedStackedFrame = GameManager.Instance.Frame; m_activeStackedState = state; break; } } } m_activeState.HandleFixedUpdate(); if (m_activeStackedState != null) { bool keep = m_activeStackedState.HandleFixedUpdate(); if (!keep) { m_activeStackedState.Abort(); m_activeStackedState = null; m_activeState.EffectualEnter(); } } //TODO; For hold effects in special states; that won't work now //T** Therefore I should define better when stuff is blocked (maybe only in m_activeStates) InputManager.Instance.IgnoreInput = false; Move(); }