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


C# GameState.LoadContent方法代码示例

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


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

示例1: ChangeState

 private void ChangeState()
 {
     if (_currentState != null)
         _currentState.UnloadContent();
     _currentState = _nextGameState;
     _currentState.LoadContent();
     _currentState.Init();
 }
开发者ID:mokujin,项目名称:DN,代码行数:8,代码来源:StateManager.cs

示例2: HandleGameState

 /// <summary>
 /// should be called when curr != prev
 /// </summary>
 void HandleGameState()
 {
     switch (curr)
     {
         case EGameState.None:
             win.Close();
             break;
         case EGameState.TitleScreen:
             state = new TitleScreen();
             state.LoadContent();
             state.Initialize();
             break;
         default:
             break;
     }
 }
开发者ID:endert,项目名称:Intro2D,代码行数:19,代码来源:Game.cs

示例3: Update

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape) || !running)
                Exit();

            currState.Update(gameTime);
            AudioManager.Update(gameTime);

            // Handle GameState transitions
            GameState newState = currState.GetTransition();
            if (newState != null)
            {
                //Set map
                if(newState == game)
                    ((StateGame)game).setMaps(((StateLevelSelect)levelMenu).getSelectedMap());
                if (newState == winScreen)
                {
                    ((StateWin)winScreen).setMap(((StateLevelSelect)levelMenu).getSelectedMap().getName()+"/victory");
                    ((StateWin)winScreen).setPlayers(((StateGame)game).players);
                }

                //State unload/load
                currState.UnloadContent();
                currState = newState;
                currState.Initialize();
                currState.LoadContent(Content);

            }

            base.Update(gameTime);
        }
开发者ID:dah6ce,项目名称:Blink,代码行数:36,代码来源:Game1.cs

示例4: LoadContent

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Should probably be in Initialize, but screen size is updated after Initialize causing weird collision issues
            Vector2 screenSize = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Right, GraphicsDevice.Viewport.TitleSafeArea.Bottom);
            game = new StateGame(screenSize);
            levelMenu = new StateLevelSelect(screenSize, "Map Select", new string[] { "Start", "Start", "Quit" }, game);
            creditsMenu = new StateCredits(screenSize, "Credits", new string[] { "Menu" });
            charMenu = new StateCharacterSelect(screenSize, "Character Select", levelMenu, game);
            //mainMenu = new StateSimpleMenu(screenSize, "Blink", new string[] { "Start", "Credits", "Quit" }, new GameState[] { charMenu, creditsMenu, new StateQuit() });
            mainMenu = new StateMainMenu(screenSize, new GameState[] { charMenu, creditsMenu, new StateQuit() });
            winScreen = new StateWin(screenSize);
            ((StateGame)game).levelSelect = levelMenu;
            ((StateGame)game).Win = winScreen;
            ((StateCredits)creditsMenu).getMenu(mainMenu);
            ((StateLevelSelect)levelMenu).prevState = charMenu;
            ((StateWin)winScreen).levelSelect = levelMenu;
            currState = mainMenu;
            currState.Initialize();
            currState.LoadContent(Content);
            AudioManager.LoadContent(Content);
        }
开发者ID:dah6ce,项目名称:Blink,代码行数:28,代码来源:Game1.cs

示例5: add

 private void add(GameState gameState)
 {
     if (!GameStates.Contains(gameState))
     {
         gameState.LoadContent();
         GameStates.Add(gameState);
     }
 }
开发者ID:wchen02,项目名称:BulletHell,代码行数:8,代码来源:GameStateManager.cs


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