public virtual void Stop()
 {
     if (State != null)
     {
         GameLog.LogFormat(StopStateTemplate, _stopColor, State.GetType().Name);
         State = null;
     }
     _executor.Stop();
 }
 public void Execute(IAsyncStateBehaviour state)
 {
     GameProfiler.BeginSample("Stop state");
     Stop();
     GameProfiler.EndSample();
     if (state == null)
     {
         Debug.LogErrorFormat("State Machine State NULL not exists in current context");
         return;
     }
     GameLog.LogFormat(ExecuteStateTemplate, _color, state);
     GameProfiler.BeginSample("ExecuteState");
     ExecuteState(state);
     GameProfiler.EndSample();
 }
 protected virtual void ExecuteState(IAsyncStateBehaviour stateBehaviour)
 {
     State = stateBehaviour;
     _executor.Execute(State.Execute());
 }
 public void Dispose()
 {
     Stop();
     State = null;
 }