コード例 #1
0
ファイル: HSM.cs プロジェクト: Hengle/HFSM-1
 /// <summary>
 /// Transition this HSM to a new state.
 /// </summary>
 /// <param name="state"> The state to transition to. </param>
 public void TransitionTo(IHState <SIG, CTX> state)
 {
     if (state != currentState)
     {
         currentState.Exit();
         currentState = state;
         currentState.Enter();
     }
 }
コード例 #2
0
ファイル: HSM.cs プロジェクト: Hengle/HFSM-1
 /// <summary>
 /// Start this state machine. Enters the current state.
 /// </summary>
 public void Start()
 {
     if (!running)
     {
         running = true;
         System.Diagnostics.Debug.WriteLine($"Starting {GetType()}");
         currentState.Enter();
     }
     else
     {
         throw new Exception("HSM is already running!");
     }
 }