/// <summary> /// 生成状态机,将所有状态和转换条件添加进去,并设置初始状态 /// </summary> private void MakeFSM() { fsm = new FSMSystem(); MenuState menuState = new MenuState(fsm, this); menuState.AddTransition(Transition.StartClickButton, StateID.Play); menuState.AddTransition(Transition.RestartToGame, StateID.Play); //todo PlayState playState = new PlayState(fsm, this); playState.AddTransition(Transition.PauseClickButton, StateID.Menu); //todo fsm.AddState(menuState); fsm.AddState(playState); fsm.Start(StateID.Menu); }