/// <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);
            }
        }
Example #2
0
 /// <summary>
 /// Is executed when the state machine leaves this state.
 /// </summary>
 public virtual void OnExit(TriggerBase trigger)
 {
 }
Example #3
0
 /// <summary>
 /// Is executed when the state machine enters this state.
 /// </summary>
 public virtual void OnEntry(TriggerBase trigger)
 {
     trigger.UpdateEntity(this.StateMachine.CurrentEntity);
 }
 /// <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);