protected void TransitionToState(BState <TEnum> nextState) { if (nextState == null) { Debug.LogError("BasicFiniteStateMachine::TransitionToState - called with invalid state!"); return; } // Delegate handling this.CallActionForMethod(_currentState.ExitKey()); this.CallActionForMethod(_currentState.TransitionToNextStateKey(nextState)); this.CallActionForMethod(nextState.EnterKey()); _currentState = nextState; _remainingTimeInState = _currentState.GenerateTime(); }
protected void InitializeState(BState <TEnum> state, TEnum[] allEnumValues) { foreach (TEnum e in allEnumValues) { if (state.Id.Equals(e)) { continue; } this.SetupActionForMethod(state.TransitionToNextStateIdKey(e)); } this.SetupActionForMethod(state.EnterKey()); this.SetupActionForMethod(state.TickKey()); this.SetupActionForMethod(state.FixedTickKey()); this.SetupActionForMethod(state.ExitKey()); }