private void AddTransition(TransitionDetails <TState, TTrigger> transition) { if (transition.FromState.State.IsEqual(State)) { if (_transitionsFrom.Contains(transition)) { return; } _transitionsFrom.Add(transition); IsFinalState = false; if (!transition.IsDynamic) { transition.ToState.AddTransition(transition); } } else { if (_transitionsTo.Contains(transition)) { return; } _transitionsTo.Add(transition); transition.FromState.AddTransition(transition); } }
public TransitionDetails <TState, TTrigger> CreateTransitionFrom(string name , TTrigger trigger , StateDetails <TState, TTrigger> toState = null , bool hasCondition = false , uint priority = 1 , bool isDynamic = false) { var transition = new TransitionDetails <TState, TTrigger>(name , this , trigger , toState , hasCondition , priority , isDynamic); AddTransition(transition); return(transition); }
public TransitionDetails <TState, TTrigger> CreateTransitionTo(string name , StateDetails <TState, TTrigger> fromState , TTrigger trigger , bool hasCondition = false , uint priority = 1 , bool isDynamic = false) { var transition = new TransitionDetails <TState, TTrigger>(name , fromState , trigger , this , hasCondition , priority , isDynamic); addTransition(transition); return(transition); }