예제 #1
0
        /// <summary>
        /// Makes the state machine go into another state.
        /// </summary>
        public void TransitionToNewState(StateBase newState, TriggerBase causedByTrigger)
        {
            // exit the current state
            if (this.CurrentState != null)
            {
                this.CurrentState.OnExit(causedByTrigger);
            }

            this.CurrentState = newState;

            UpdateEntityState();
            // enter the new state
            if (this.CurrentState != null)
            {
                this.CurrentState.OnEntry(causedByTrigger);
            }
        }
예제 #2
0
        /// <summary>
        /// Makes the state machine go into another state.
        /// </summary>
        public async Task TransitionToNewStateAsync(StateBase newState, TriggerBase causedByTrigger)
        {
            // exit the current state
            if (this.CurrentState != null)
            {
                await this.CurrentState.OnExitAsync(causedByTrigger);
            }

            this.CurrentState = newState;

            UpdateEntityState();
            // enter the new state
            if (this.CurrentState != null)
            {
                await this.CurrentState.OnEntryAsync(causedByTrigger);
            }
        }
예제 #3
0
 /// <summary>
 /// Makes the state machine recive a command. Depending on its current state
 /// and the designed transitions the machine reacts to the trigger.
 /// </summary>
 public abstract void ProcessTrigger(TriggerBase trigger);
예제 #4
0
 /// <summary>
 /// Is executed when the state machine leaves this state.
 /// </summary>
 public virtual void OnExit(TriggerBase trigger)
 {
 }
예제 #5
0
 /// <summary>
 /// Is executed when the state machine enters this state.
 /// </summary>
 public virtual void OnEntry(TriggerBase trigger)
 {
     trigger.UpdateEntity(this.StateMachine.CurrentEntity);
 }
예제 #6
0
 public virtual async Task OnExitAsync(TriggerBase trigger)
 {
 }
예제 #7
0
 public virtual async Task OnEntryAsync(TriggerBase trigger)
 {
     trigger.UpdateEntity(this.StateMachine.CurrentEntity);
 }
예제 #8
0
 /// <summary>
 /// Makes the state machine recive a command. Depending on its current state
 /// and the designed transitions the machine reacts to the trigger.
 /// </summary>
 public virtual void ProcessTrigger(TriggerBase trigger)
 {
     throw new NotImplementedException();
 }
예제 #9
0
 /// <summary>
 /// Makes the state machine recive a command. Depending on its current state
 /// and the designed transitions the machine reacts to the trigger.
 /// </summary>
 public virtual Task ProcessTriggerAsync(TriggerBase trigger)
 {
     throw new NotImplementedException();
 }