//////////////////////////// ////////// Method ////////// //////////////////////////// /////////////////////////////// ////////// Mechanism ////////// /// <summary> /// Initialize the finite state machine /// </summary> protected virtual void Initialize() { CurrentState = EntryState; if (CurrentState == null) { Debug.LogError(ErrorMessageNoEntryState); } }
/// <summary> /// Attempt to transit to the next state /// </summary> protected virtual void UpdateCurrentState() { if ((CurrentState != null) && (!PauseMachine)) { var nextState = CurrentState.AttemptToGetNextState(Datas); if (nextState != null) { PreviousState = CurrentState; CurrentState = nextState; CurrentState.Begin(Datas); if (DisplayDebugLog) { DisplayTransitionLog(); } } } }