当前位置: 首页>>代码示例>>C#>>正文


C# StateMachine.State方法代码示例

本文整理汇总了C#中StateMachine.State方法的典型用法代码示例。如果您正苦于以下问题:C# StateMachine.State方法的具体用法?C# StateMachine.State怎么用?C# StateMachine.State使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StateMachine的用法示例。


在下文中一共展示了StateMachine.State方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

        // Here we initialize our app.
        public override void Setup()
        {
            //Init Hashtables
            cHash = new Hashtable();
            pHash = new Hashtable();
            eHash = new Hashtable();

            int i = 0;

            // Load up the list of images.
            mImageNames = LoadImageIndex();
            mDripNames = LoadDripIndex("r");
            mPdripNames = LoadPdripIndex("r");
            mYDripNames = LoadDripIndex("y");
            mYPdripNames = LoadPdripIndex("y");
            mBDripNames = LoadDripIndex("b");
            mBPdripNames = LoadPdripIndex("b");
            mBEcoliNames = LoadEColiIndex("b");
            mREcoliNames = LoadEColiIndex("r");
            mYEcoliNames = LoadEColiIndex("y");
            mEcoliNames = LoadEColiIndex("w");
            mEcoliTravelNames = LoadSameEColiTravelIndex("w");
            mBEcoliTravelNames = LoadSameEColiTravelIndex("b");
            mREcoliTravelNames = LoadSameEColiTravelIndex("r");
            mYEcoliTravelNames = LoadSameEColiTravelIndex("y");

            mBYEcoliTravelNamesC1 = LoadMixC1EcoliTravelIndex("b", "y");
            mBYEcoliTravelNamesC2 = LoadMixC2EcoliTravelIndex("b", "y");

            mRBEcoliTravelNamesC1 = LoadMixC1EcoliTravelIndex("r", "b");
            mRBEcoliTravelNamesC2 = LoadMixC2EcoliTravelIndex("r", "b");

            mRYEcoliTravelNamesC1 = LoadMixC1EcoliTravelIndex("r", "y");
            mRYEcoliTravelNamesC2 = LoadMixC2EcoliTravelIndex("r", "y");

            mWBEcoliTravelNamesC1 = LoadMixC1EcoliTravelIndex("w", "b");
            mWBEcoliTravelNamesC2 = LoadMixC2EcoliTravelIndex("w", "b");

            mWREcoliTravelNamesC1 = LoadMixC1EcoliTravelIndex("w", "r");
            mWREcoliTravelNamesC2 = LoadMixC2EcoliTravelIndex("w", "r");

            mWYEcoliTravelNamesC1 = LoadMixC1EcoliTravelIndex("w", "y");
            mWYEcoliTravelNamesC2 = LoadMixC2EcoliTravelIndex("w", "y"); 


            Array.Sort(mDripNames);
            Array.Sort(mPdripNames);
            Array.Sort(mYDripNames);
            Array.Sort(mYPdripNames);
            Array.Sort(mBDripNames);
            Array.Sort(mBPdripNames);
            Array.Sort(mBEcoliNames);
            Array.Sort(mREcoliNames);
            Array.Sort(mYEcoliNames);
            Array.Sort(mEcoliNames);
            Array.Sort(mEcoliTravelNames);
            Array.Sort(mBEcoliTravelNames);
            Array.Sort(mREcoliTravelNames);
            Array.Sort(mYEcoliTravelNames);
            Array.Sort(mBYEcoliTravelNamesC1);
            Array.Sort(mBYEcoliTravelNamesC2);
            Array.Sort(mRBEcoliTravelNamesC1);
            Array.Sort(mRBEcoliTravelNamesC2);
            Array.Sort(mRYEcoliTravelNamesC1);
            Array.Sort(mRYEcoliTravelNamesC2);
            Array.Sort(mWBEcoliTravelNamesC1);
            Array.Sort(mWBEcoliTravelNamesC2);
            Array.Sort(mWREcoliTravelNamesC1);
            Array.Sort(mWREcoliTravelNamesC2);
            Array.Sort(mWYEcoliTravelNamesC1);
            Array.Sort(mWYEcoliTravelNamesC2);


            //Init the StateMachine
            sm = new StateMachine();

            //Init the Controllers
            whitePlasmidController = new PlasmidController(this);
            yellowPlasmidController = new YellowPlasmidController(this);
            redPlasmidController = new RedPlasmidController (this);
            bluePlasmidController = new BluePlasmidController(this);

            sm.State("White", whitePlasmidController);
            sm.State("Yellow", yellowPlasmidController);
            sm.State("Red", redPlasmidController);
            sm.State("Blue", bluePlasmidController);

            sm.Transition("White", tWhiteToYellow, "Yellow");
            sm.Transition("White", tWhiteToRed, "Red");
            sm.Transition("White", tWhiteToBlue, "Blue");

            sm.SetState("White", tWhiteToYellow);
            

            //Log.Debug("mImageNames Length: " + mImageNames.Length);
            //Log.Debug("mDripNames Length: " + mDripNames.Length);
            //Log.Debug("mPdripNames Length: " + mPdripNames.Length);
            //Log.Debug("mYDripNames Length: " + mYDripNames.Length);
            //Log.Debug("mYPdripNames Length: " + mYPdripNames.Length);
//.........这里部分代码省略.........
开发者ID:cvaldes2328,项目名称:SynFloSifteo1.0App,代码行数:101,代码来源:EColiTest.cs

示例2: SetupStateMachine

        /*
         * StateMachine Initialization
         */
        private StateMachine SetupStateMachine()
        {
            //Init the State Machine
            StateMachine sm = new StateMachine ();

            //Init the Controllers
            titleController = new TitleController ();
            menuController = new MenuController ();
            gameController = new GameController ();
            gameBeginController = new GameBeginController ();
            gameEndController = new GameEndController ();

            sm.State (Constants.TitleState, titleController);
            sm.State (Constants.MenuState, menuController);
            sm.State (Constants.GameState, gameController);
            sm.State (Constants.GameBegin, gameBeginController);
            sm.State (Constants.GameEndState, gameEndController);

            sm.Transition ("Title", "TitleToMenu", "Menu");
            sm.Transition (Constants.MenuState, Constants.tMenuToGameBegin, Constants.GameBegin);
            sm.Transition (Constants.GameBegin, Constants.tGameBeginToMenu, Constants.MenuState);
            sm.Transition (Constants.GameBegin, Constants.tGameBeginToGame, Constants.GameState);
            sm.Transition (Constants.GameState, Constants.tGameToGameEnd, Constants.GameEndState);
            sm.Transition (Constants.GameEndState, Constants.tGameEndToMenu, Constants.MenuState);
            //Set the Current State
            sm.SetState (Constants.MenuState, Constants.tMenuToGameBegin);

            return sm;
        }
开发者ID:cdesch,项目名称:MathScramble,代码行数:32,代码来源:MathScramble.cs

示例3: Setup

        // called during intitialization, before the game has started to run
        public override void Setup()
        {
            Log.Debug ("Setup()");
            mNeedCheck = true;

            // Load up the list of images.
            mImageNames = LoadImageIndex ();

            System.Version myVersion = System.Reflection.Assembly.GetExecutingAssembly ().GetName ().Version;
            Log.Debug (myVersion.ToString ());

            //Init the State Machine
            sm = new StateMachine ();

            //Init the Controllers
            titleController = new TitleController ();
            menuController = new MenuController (this, CubeSet);
            gameController = new GameController ();
            gameBeginController = new GameBeginController (this, CubeSet);
            gameShuffleController = new GameShuffleController (this, CubeSet);
            gameEndController = new GameEndController (this, CubeSet);

            sm.State ("Title", titleController);
            sm.State ("Menu", menuController);
            sm.State ("Game", gameController);
            sm.State ("GameBegin", gameBeginController);
            sm.State ("GameShuffle", gameShuffleController);
            sm.State ("GameEnd", gameEndController);

            sm.Transition ("Title", "TitleToMenu", "Menu");
            sm.Transition ("Menu", tMenuToGameBegin, "GameBegin");
            sm.Transition ("GameBegin", tGameBeginToMenu, "Menu");
            sm.Transition ("GameBegin", tGameBeginToGameShuffle, "GameShuffle");
            sm.Transition ("GameShuffle", tGameShuffleToGameEnd, "GameEnd");
            sm.Transition ("GameEnd", tGameEndToMenu, "Menu");

            sm.SetState ("Menu", "MenuToGameBegin");

            // Loop through all the cubes and set them up.
            lastIndex = 1;

            foreach (Cube cube in CubeSet) {

                CubeWrapper wrapper = new CubeWrapper (this, cube, lastIndex);
                lastIndex += 1;
                mWrappers.Add (wrapper);
            }

            this.PauseEvent += OnPause;
            this.UnpauseEvent += OnUnpause;
            CubeSet.NewCubeEvent += OnNewCube;
            CubeSet.LostCubeEvent += OnLostCube;
            CubeSet.NeighborAddEvent += OnNeighborAdd;
            CubeSet.NeighborRemoveEvent += OnNeighborRemove;
        }
开发者ID:cdesch,项目名称:ThreeCardMonte,代码行数:56,代码来源:ThreeCardMonte.cs

示例4: InitStateMachine

        //Setup Operand Cube
        private void InitStateMachine()
        {
            mCubeStateMachine = new StateMachine ();

            operandController = new OperandController (mCube);
            operatorController = new OperatorController (mCube);
            hintController = new HintController (mCube);
            resultController = new ResultController (mCube);

            mCubeStateMachine.State (Constants.HintState, hintController);
            mCubeStateMachine.State (Constants.OperandState, operandController);
            mCubeStateMachine.State (Constants.OperatorState, operatorController);
            mCubeStateMachine.State (Constants.ResultState, resultController);

            mCubeStateMachine.Transition (Constants.OperandState, Constants.tOperandToOperatorState, Constants.OperatorState);
            mCubeStateMachine.Transition (Constants.OperatorState, Constants.tOperatorToOperandState, Constants.OperandState);

            mCubeStateMachine.SetState (mRole.stateName, mRole.stateTransition);

            /*
            if (mIndex == 6) { //Must have 6 cubes to play
                //Set hint cube as last cube in set
                mCubeStateMachine.SetState (Constants.HintState, Constants.tTitleToHintState);

                //Value is negative for Hint Cube
                mValue = -1;
            } else if (mIndex % 2 == 0) {
                //Number is Even - Make that cube an Operator Cube
                SetupOperandCube ();
            }

            mCubeStateMachine.SetState (Constants.OperandState, Constants.tTitleToOperandState);

            //Randome for OperandCube
            mValue = RandomNumber (0, 9);
            */
        }
开发者ID:cdesch,项目名称:MathScramble,代码行数:38,代码来源:MathScramble.cs


注:本文中的StateMachine.State方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。