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); }
public ITransitionGraph GoTo <T> () where T : SState { this.next = this.context.Create <T> (); return(this.parent); }