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


C# StateManager.AddState方法代码示例

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


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

示例1: ShouldFailWhenTryingToAddTheSameStateTwice

        public void ShouldFailWhenTryingToAddTheSameStateTwice()
        {
            var state = new StartState();

            var manager = new StateManager<IGameLogicState>(null);

            manager.AddState(state);
            manager.AddState(state);
        }
开发者ID:gbenatti,项目名称:TDWorld,代码行数:9,代码来源:StateManagerFixture.cs

示例2: ShouldSupportStatesBeingAdded

        public void ShouldSupportStatesBeingAdded()
        {
            var manager = new StateManager<IGameLogicState>(null);

            manager.AddState(new StartState());
            Assert.AreEqual(1, manager.StateCount);

            manager.AddState(new MenuState());
            Assert.AreEqual(2, manager.StateCount);
        }
开发者ID:gbenatti,项目名称:TDWorld,代码行数:10,代码来源:StateManagerFixture.cs

示例3: ShouldSupportStatesBeingRemoved

        public void ShouldSupportStatesBeingRemoved()
        {
            var state1 = new StartState();
            var state2 = new MenuState();

            var manager = new StateManager<IGameLogicState>(null);

            manager.AddState(state1);
            manager.AddState(state2);

            Assert.AreEqual(2, manager.StateCount);

            manager.RemoveState(state1);

            Assert.AreEqual(1, manager.StateCount);
        }
开发者ID:gbenatti,项目名称:TDWorld,代码行数:16,代码来源:StateManagerFixture.cs

示例4: CreateStateInstances

    void CreateStateInstances()
    {
        MovementStateManager = new StateManager("Player Movement State Manager", this.gameObject);
        CombatStateManager = new StateManager("Player Combat State Manager", this.gameObject);

        MovementStateManager.AddState(new PlayerState_Idle(MovementStateManager));
        MovementStateManager.AddState(new PlayerState_Walk(MovementStateManager));
        MovementStateManager.AddState(new PlayerState_Jump(MovementStateManager));
        MovementStateManager.AddState(new PlayerState_Fall(MovementStateManager));
        MovementStateManager.AddState(new PlayerState_Rotate(MovementStateManager));
        MovementStateManager.AddState(new PlayerState_Shmup(MovementStateManager));

        MovementStateManager.SetNextState("PlayerState_Idle");
    }
开发者ID:Garmichael,项目名称:Project-Boomerang,代码行数:14,代码来源:PlayerController.cs

示例5: LoadContent

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Intro sounds
            audioManager.addEffect(audioList.getValue("Intro", "startup"), "intro_startup");

            // Main Menu Sounds
            audioManager.addEffect(audioList.getValue("MainMenu", "move"), "menu_move");
            audioManager.addEffect(audioList.getValue("MainMenu", "select"), "menu_select");
            audioManager.addEffect(audioList.getValue("MainMenu", "start"), "menu_start");
            audioManager.addSong(audioList.getValue("MainMenu", "music"), "menu_music");

            // World Map Sounds
            audioManager.addEffect(audioList.getValue("WorldMap", "select"), "map_select");
            audioManager.addEffect(audioList.getValue("WorldMap", "move"), "map_move");
            audioManager.addEffect(audioList.getValue("WorldMap", "selectMap"), "map_select_map");
            audioManager.addEffect(audioList.getValue("WorldMap", "back"), "map_back");
            audioManager.addSong(audioList.getValue("WorldMap", "music"), "map_music");

            // In Game Sounds
            audioManager.addEffect(audioList.getValue("InGame", "player_shoot"), "player_shoot");
            audioManager.addEffect(audioList.getValue("InGame", "player_die"), "player_die");
            audioManager.addEffect(audioList.getValue("InGame", "player_powerup_pickup"), "player_powerup_pickup");
            audioManager.addEffect(audioList.getValue("InGame", "dark_thought_shoot"), "dark_thought_shoot");
            audioManager.addEffect(audioList.getValue("InGame", "dark_thought_die"), "dark_thought_die");
            audioManager.addEffect(audioList.getValue("InGame", "red_bloodvessel_die"), "red_bloodvessel_die");
            audioManager.addEffect(audioList.getValue("InGame", "blue_bloodvessel_die"), "blue_bloodvessel_die");
            audioManager.addEffect(audioList.getValue("InGame", "purple_bloodvessel_die"), "purple_bloodvessel_die");
            audioManager.addEffect(audioList.getValue("InGame", "nightmare_die"), "nightmare_die");
            audioManager.addEffect(audioList.getValue("InGame", "nightmare_hit"), "nightmare_hit");
            audioManager.addEffect(audioList.getValue("InGame", "inner_demon_die"), "inner_demon_die");
            audioManager.addEffect(audioList.getValue("InGame", "lesser_demon_spawn"), "lesser_demon_spawn");
            audioManager.addEffect(audioList.getValue("InGame", "lesser_demon_die"), "lesser_demon_die");
            audioManager.addEffect(audioList.getValue("InGame", "dark_whisper_die"), "dark_whisper_die");
            audioManager.addEffect(audioList.getValue("InGame", "dark_whisper_release_spikes"), "release_spikes");
            audioManager.addEffect(audioList.getValue("InGame", "pause_appear"), "pause_appear");
            audioManager.addSong(audioList.getValue("InGame", "music"), "main_music");
            audioManager.addSong(audioList.getValue("InGame", "music_secondary"), "secondary_music");

            stateManager = new StateManager();

            controls = new InputManager(this);
            State state = new IntroState(spriteBatch, this, audioManager, controls, "IntroState");
            stateManager.AddState(state);
            state = new MenuState(spriteBatch, this, graphics, displayModes, audioManager, controls, "MenuState");
            stateManager.AddState(state);
            state = new CreditsState(spriteBatch, this, audioManager, controls, "CreditsState");
            stateManager.AddState(state);
            state = new WorldMapState(spriteBatch, this, audioManager, controls, "WorldMapState");
            stateManager.AddState(state);
            state = new PlayState(spriteBatch, this, audioManager, controls, "PlayState");
            stateManager.AddState(state);
            state = new WarningState(spriteBatch, this, audioManager, controls, "WarningState");
            stateManager.AddState(state);
            stateManager.SetState(config.getValue("General", "StartState"));
        }
开发者ID:rodstrom,项目名称:soul,代码行数:57,代码来源:Soul.cs


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