本文整理汇总了C#中Transition.InitFromExpression方法的典型用法代码示例。如果您正苦于以下问题:C# Transition.InitFromExpression方法的具体用法?C# Transition.InitFromExpression怎么用?C# Transition.InitFromExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transition
的用法示例。
在下文中一共展示了Transition.InitFromExpression方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake() {
controllerCamera = Camera.mainCamera;
//Setup Messenger
Messenger.AddListener(InputManager.kMegatileCapMet, OnOpenMenu);
Messenger<Vector3>.AddListener(InputManager.kRightClickedTile, OnCloseMenu);
Messenger.AddListener(kClose, OnCloseMenu);
//Setup GUIGroup
menuGroup = new GUIContainer(controllerCamera.pixelRect,false);
menuGroup.anchor.Set(GUIAnchor.BottomCenter);
GameGUIManager.AddGUIObject(menuGroup);
//Setup Transitions and State Machine
Transition<TileSelectionMenu> goToOptions = new Transition<TileSelectionMenu>(this, states["Options"]);
Transition<TileSelectionMenu> closeMenu = new Transition<TileSelectionMenu>(this, states["Waiting"]);
states["Waiting"].AddTransition(goToOptions);
states["Options"].AddTransition(closeMenu);
goToOptions.InitFromExpression ( "{ TransitionBehavior_OnEvent openMenu( OpenMenu ); } openMenu");
closeMenu.InitFromExpression ( "{ TransitionBehavior_OnEvent closeMenu( CloseMenu ); } closeMenu");
behaviour.ChangeState( states["Waiting"], this );
}
示例2: InitBehaviors
protected virtual void InitBehaviors() {
Transition<LoginGUI> loginToSelectWorld = new Transition<LoginGUI>( this, selectWorldState );
Transition<LoginGUI> selectWorldToLogin = new Transition<LoginGUI>( this, loginState );
Transition<LoginGUI> createWorldToSelectWorld = new Transition<LoginGUI>( this, selectWorldState );
Transition<LoginGUI> selectClassToWaitingToEnterGame = new Transition<LoginGUI>( this, waitingToEnterGame );
Transition<LoginGUI> createWorldToSelectClass = new Transition<LoginGUI>( this, selectClassState );
loginState.AddTransition( loginToSelectWorld );
selectWorldState.AddTransition( selectWorldToLogin );
selectClassState.AddTransition( selectClassToWaitingToEnterGame );
loginToSelectWorld.InitFromExpression( "{ TransitionBehavior_OnState isLoggedIn( LoggedIn ); } isLoggedIn" );
selectWorldToLogin.InitFromExpression( "{ TransitionBehavior_OnState isLoggedIn( LoggedIn ); } !isLoggedIn" );
createWorldToSelectWorld.InitFromExpression( "{ TransitionBehavior_OnEvent onCancel( OnCancelCreateGame ); } onCancel" );
createWorldToSelectClass.InitFromExpression( "{ TransitionBehavior_OnEvent onSelectClass( OnSelectClass ); } onSelectClass" );
selectClassToWaitingToEnterGame.InitFromExpression( "{ TransitionBehavior_OnEvent onJoinGame( OnJoinGame ); } onJoinGame" );
#if FOR_GLS
Transition<LoginGUI> selectWorldToSelectClass = new Transition<LoginGUI>( this, selectClassState );
Transition<LoginGUI> selectClassToSelectWorld = new Transition<LoginGUI>( this, selectWorldState );
selectWorldState.AddTransition( selectWorldToSelectClass );
selectClassState.AddTransition( selectClassToSelectWorld );
selectWorldToSelectClass.InitFromExpression( "{ TransitionBehavior_OnEvent onCreateGame( OnCreateGame ); TransitionBehavior_OnEvent onJoinGame( OnJoinGame ); } onCreateGame | onJoinGame" );
selectClassToSelectWorld.InitFromExpression( "{ TransitionBehavior_OnEvent onCancel( OnCancelSelectClass ); } onCancel" );
#else
Transition<LoginGUI> selectWorldToCreateWorld = new Transition<LoginGUI>( this, createGameState );
Transition<LoginGUI> selectClassToCreateWorld = new Transition<LoginGUI>( this, createGameState );
selectWorldState.AddTransition( selectWorldToCreateWorld );
createGameState.AddTransition( createWorldToSelectWorld );
createGameState.AddTransition( createWorldToSelectClass );
selectClassState.AddTransition( selectClassToCreateWorld );
selectWorldToCreateWorld.InitFromExpression( "{ TransitionBehavior_OnEvent onCreateGame( OnCreateGame ); } onCreateGame" );
selectClassToCreateWorld.InitFromExpression( "{ TransitionBehavior_OnEvent onCancel( OnCancelSelectClass ); } onCancel" );
#endif
behavior.ChangeState( loginState, this );
}