Example #1
0
        protected void ExecuteState(TStateType state)
        {
            if (!ValidateTransition(state))
            {
                return;
            }
            PreviousState = CurrentState;

            StateLogger.LogStateChanged(this?.GetType().Name,
                                        CurrentState?.GetType().Name, state?.GetType().Name);

            CurrentState = state;
            ChangeState(state);
        }
        public void Execute(TState state)
        {
            StateLogger.LogStateChanged(this, State, state);

            GameProfiler.BeginSample("Stop state");
            Stop();
            GameProfiler.EndSample();

            State = state;
            StateEnter(State);

            GameProfiler.BeginSample("ExecuteState");
            _executor.Execute(state);
            GameProfiler.EndSample();
        }