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


C# IGameState.Initialize方法代码示例

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


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

示例1: SwitchState

 internal static void SwitchState(IGameState newstate)
 {
     if (CurrentState != null) {
         CurrentState.Uninitialize();
     }
     newstate.Initialize();
     CurrentState = newstate;
 }
开发者ID:CloneDeath,项目名称:Xanatos,代码行数:8,代码来源:Program.cs

示例2: Initialize

        public void Initialize()
        {
            var strikeInfo = _gameObjects["currentStrikeInfo"] as StrikeInfo;
            var enableQuestioning = strikeInfo.Quiz != null && strikeInfo.Quiz.Count > 0;

            var currentGame = _gameObjects["currentGame"] as Game;
            if (currentGame == null) throw new NullReferenceException("currentGame");

            var userPlayScenario = GetUserPlayScenario(_gameObjects, enableQuestioning);
            var scenario = currentGame.Type == GameTypeEnum.Competition ? GetCompetitionScenario(_gameObjects, userPlayScenario) : userPlayScenario;

            _activeState = scenario[0];

            _activeState.Initialize();
        }
开发者ID:AndreyNesterkin,项目名称:GolfTestingProject,代码行数:15,代码来源:StrikePlayer.cs

示例3: Play

        public bool Play()
        {
            var looping = _activeState.Loop();

            if (!looping)
            {
                _activeState = _activeState.NextState;

                if (_activeState != null)
                {
                    _activeState.Initialize();

                    looping = true;
                }
            }

            return looping;
        }
开发者ID:AndreyNesterkin,项目名称:GolfTestingProject,代码行数:18,代码来源:StrikePlayer.cs

示例4: Initialize

        public void Initialize()
        {
            gameStates.Clear();

            var currentGame = _gameObjects["currentGame"] as Game;

            if (currentGame == null) throw new NullReferenceException("currentGame");

            IGameState result = null;

            if (currentGame.Type == GameTypeEnum.Competition)
            {
                result = new ShowCompetitionResultGameState() { GameObjects = _gameObjects };
                gameStates.Add(result);
            }
            else
            {
                result = new ShowTrainingResultGameState() {GameObjects = _gameObjects};
                gameStates.Add(result);
            }

            var play = new PlayGameState() { GameObjects = _gameObjects, NextState = result };
            gameStates.Add(play);

            var init = new InitGameState() { NextState = play, GameObjects = _gameObjects };
            gameStates.Add(init);

            var start = new StartingGameState() { GameObjects = _gameObjects, NextState = init };
            gameStates.Add(start);

            var instruction = new ShowInstructionGameState() {GameObjects = _gameObjects, NextState = start};
            gameStates.Add(instruction);

            _activeState = instruction;

            _activeState.Initialize();
        }
开发者ID:AndreyNesterkin,项目名称:GolfTestingProject,代码行数:37,代码来源:GamePlayer.cs

示例5: Play

        public bool Play()
        {
            var looping = _activeState.Loop();

            if (_activeState.IsCancelled)
            {
                IsCancelled = true;
            }

            if (IsCancelled) return false;

            if (!looping)
            {
                _activeState = _activeState.NextState;

                if (_activeState != null)
                {
                    _activeState.Initialize();

                    looping = true;
                }
            }

            return looping;
        }
开发者ID:AndreyNesterkin,项目名称:GolfTestingProject,代码行数:25,代码来源:GamePlayer.cs

示例6: Initialize

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth = windowWidth;
            graphics.PreferredBackBufferHeight = windowHeight;
            graphics.ApplyChanges();

            currentState = new PreConnectionState(this);
            currentState.Initialize();

            // call other classes' Initialize methods here

            base.Initialize();
        }
开发者ID:sphippen,项目名称:connect4,代码行数:19,代码来源:Connect4.cs

示例7: ChangeState

 public void ChangeState(IGameState state)
 {
     currentState.Uninitialize();
     state.Initialize();
     currentState = state;
 }
开发者ID:sphippen,项目名称:connect4,代码行数:6,代码来源:Connect4.cs


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