public void RegisterState(BugToken token, BugState[] fromStates, BugState toState, Action @event)
 {
     mTokenValidation.Add(token, fromStates);
     mTokenActions.Add(token, delegate {
         if (mTokenValidation[mCurrentToken].Contains(CurrentState))
         {
             CurrentState = toState;
             @event?.Invoke();
         }
         else
         {
             throw new Exception(String.Format("Invalid Change from {0} to {1} with {2}", CurrentState, toState, token));
         }
     });
 }
            public bool SetToken(BugToken token)
            {
                try
                {
                    mCurrentToken = token;
                    mTokenActions[token]();

                    OnGround = CurrentState == BugState.Normal || CurrentState == BugState.Horny;

                    return(true);
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);
                    return(false);
                }
            }
 public bool SetTocken(BugToken token) => mStateMachin.SetToken(token);