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


C# StateMachine.SetState方法代码示例

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


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

示例1: Start

    protected override void Start()
    {
        base.Start();//gets the start from living entity
        startingHealth += startingHealth/100*waveStats._percentHP;
        health = startingHealth;
        print(health + "hp");
        /** we halen een referentie op naar de state machine */
        stateMachine = GetComponent<StateMachine>();
        //anim.GetComponent<Animator>();
        /** we voegen de verschillende states toe aan de state machine */
		MakeStates();

        /** we geven de eerste state door (rondlopen) */
        if (patrol)
        {
            stateMachine.SetState(StateID.Patrol);
        }
        else if(charge)
        {
            stateMachine.SetState(StateID.Charge);
        }
        else
        {
            stateMachine.SetState(StateID.Wandering);
        }

    }
开发者ID:DavidZwit,项目名称:MytheDAG2016,代码行数:27,代码来源:Guard.cs

示例2: Start

    void Start()
    {
        enemyAnimator = GetComponentInChildren<Animator>();
        stateMachine = GetComponent<StateMachine>();
        waypoints = new List<GameObject>();
        shader = transform.Find("Character1").GetComponent<SkinnedMeshRenderer>();

        MakeStates();
        stateMachine.SetState( StateID.Wandering );
    }
开发者ID:SkaterDanny,项目名称:3D-DreamTeam,代码行数:10,代码来源:Enemy.cs

示例3: Start

    // Use this for initialization
    protected override void Start()
    {
        base.Start();//gets the start from living entity
        /** we halen een referentie op naar de state machine */
        stateMachine = GetComponent<StateMachine>();

        /** we voegen de verschillende states toe aan de state machine */
        MakeStates();

        /** we geven de eerste state door (rondlopen) */
        stateMachine.SetState(StateID.Wandering);
    }
开发者ID:DavidZwit,项目名称:MytheDAG2016,代码行数:13,代码来源:Citizen.cs

示例4: Start

    // Use this for initialization
    void Start()
    {
        stateMachine = new StateMachine(this.gameObject);
        this.states = this.transform.FindChild("States").gameObject;

        var buildState = StartState;
        stateMachine.SetState( buildState );

        var waveInfo = GameObject.FindGameObjectWithTag("WaveTextUI");
        if ( waveInfo != null && waveInfo.guiText != null)
        {
            waveInfo.guiText.text = "";
        }
    }
开发者ID:GhostTap,项目名称:SolarStrike,代码行数:15,代码来源:GameFlow.cs

示例5: Start

    // Use this for initialization
    void Start()
    {
        stateMachine = new StateMachine(this.gameObject);

        //Find the patrol state from our component list and set it.
        var patrol = GetComponent<PatrolState>();
        patrol.Target = Target;
        patrol.WayPoints = WayPoints;
        patrol.StateGameObject = this.gameObject;
        patrol.Start();

        stateMachine.SetState( patrol );

        //Just makes moving around easier:
        movement = new MovementUtil();
        movement.ControlObject = this.gameObject;
        movement.MaxSpeed = 10.0f;

        patrol.movement = movement;
    }
开发者ID:GhostTap,项目名称:SolarStrike,代码行数:21,代码来源:EnemyAIStateMachine.cs

示例6: Start

	void Start () 
    {
        stateMachine = GetComponent<StateMachine>();
        MakeStates();
        stateMachine.SetState(StateID.Roar);
	}
开发者ID:18839,项目名称:Mythe,代码行数:6,代码来源:Boss.cs

示例7: 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

示例8: 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

示例9: Start

    void Start()
    {
        _navComponent = GetComponent<NavMeshAgent> ();
        _stateMachine = GetComponent<StateMachine> ();

        MakeStates ();

        _stateMachine.SetState (StateID.IdleState);
    }
开发者ID:Jprummel,项目名称:Trials-of-an-Argonaut,代码行数:9,代码来源:BullBehaviour.cs

示例10: Start

    void Start()
    {
        // Setup state machine.
        fsm = new StateMachine<GameManager>(this);
        fsm.SetState(new SplashState());

        numberOfHumanPlayers = 0;
        numberOfLaps = 0;
        spawnsSet = false;
        carsInstantiated = false;
        nameOfPlayers = new List<string>();
        playerCars = new List<int>();
        carSelected = new List<bool>();
        cars = new List<GameObject>();
        finalPositions = new List<GameObject>(0);
    }
开发者ID:Rarau,项目名称:racing_game,代码行数:16,代码来源:GameManager.cs

示例11: Initialize

        public void Initialize(Highscore score, int[] ranks, float loot, int[] salvage, bool nextIsUnlocked)
        {
            // cache data
            playerScore = score.score;
            rankThresholds = ranks;
            playerRank = score.rank;
            playerLoot = loot;
            playerSalvage = salvage;

            // buttons
            replayButton.ActivateEvent += (sender, args) => SceneManager.ReloadScene();
            int nextLevel = ((FormationLevelManager)FormationLevelManager.Main).levelIndex + 1;
            if (nextLevel < FormationLevelManager.LevelNames.Length && (score.rank != 0 || nextIsUnlocked))
            {
                nextButton.ActivateEvent += (sender, args) => SceneManager.LoadScene(Scenes.Scene((Scenes.Levels)((FormationLevelManager)FormationLevelManager.Main).levelIndex + 1));
            }
            else
            {
                nextAvailable = true;
            }

            states = new StateMachine(this, InitializingState);
            states.CreateState(InitializingState, InitializingEnter, info => { });
            states.CreateState(TimeState, info =>
                                          {
                                              timeLabel.text = score.TimeString;
                                              states.SetState(LootState);
                                          }, info => { });
            states.CreateState(LootState, info => states.SetUpdate(LootUpdate()), info => { });
            states.CreateState(SalvageState, info => states.SetUpdate(SalvageUpdate()), info => { });
            states.CreateState(IdleState, info => { }, info => { });
            states.CreateState(CompleteState, CompleteEnter, info => { });
            states.Start();
        }
开发者ID:syeager,项目名称:Space-CUBEs,代码行数:34,代码来源:CampaignOverview.cs

示例12: 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

示例13: 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

示例14: AzmythGame

        public AzmythGame()
        {
            m_graphics = new GraphicsDeviceManager(this);

            m_stateManager = new StateMachine<GameStates>();
            m_stateManager.SetState(GameStates.Loading);

            m_playerManager = new PlayerManager(this);
            m_terrainManager = new TerrainManager(this);

            Components.Add(m_playerManager);
            Components.Add(m_terrainManager);

            Content.RootDirectory = "Content";
        }
开发者ID:GalacticSoft,项目名称:Azmyth,代码行数:15,代码来源:AzmythGame.cs

示例15: Start

    // Use this for initialization
    void Start()
    {
        input = new XboxInput ((XboxController)playerIndex);
        ballMaterial = GetComponent<Renderer> ().material;
        initialColor = ballMaterial.color;

        arrow.SetActive (false);
        //
        stateMachine = new StateMachine (this);
        stateMachine.SetState (new IdleState ());

        //		direction = new Vector3 (0, 0, 0);
        //		rb = GetComponent<Rigidbody> ();
        startPos = transform.position;

        //		shootLock = new TimeDurationLock (1);
    }
开发者ID:adamborowski,项目名称:fussnooker,代码行数:18,代码来源:BallController.cs


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