public void AddState <TState>() where TState : FsmState <T> { Type tmpStateType = typeof(TState); if (!mStates.ContainsKey(tmpStateType)) { TState tmpState = Activator.CreateInstance <TState>(); mStates.Add(tmpStateType, tmpState); tmpState.OnInit(this); } }