Example #1
0
        public T Get <T> () where T : SState, new ()
        {
            SState state = null;

            this.states.TryGetValue(typeof(T), out state);

            if (state != null)
            {
                return((T)state);
            }

            FactoryFunc <SState> factoryMethod = null;

            this.factories.TryGetValue(typeof(T), out factoryMethod);

            if (factoryMethod != null)
            {
                return((T)factoryMethod.Invoke());
            }

            var newState = new T();

            newState.Context = this;

            return(newState);
        }
Example #2
0
 public ITransitionGraph GoTo <T> () where T : SState
 {
     this.next = this.context.Create <T> ();
     return(this.parent);
 }