コード例 #1
0
ファイル: SceneManager.cs プロジェクト: ThomasCOLLIN/devjv
        public override void Update(GameTime gameTime)
        {
            _scenesToUpdate.Clear();

            foreach (Scene scene in _scenes)
            {
                _scenesToUpdate.Add(scene);
            }

            bool othersceneHasFocus  = !Game.IsActive;
            bool coveredByOtherscene = false;

            while (_scenesToUpdate.Count > 0)
            {
                Scene scene = _scenesToUpdate[_scenesToUpdate.Count - 1];
                _scenesToUpdate.RemoveAt(_scenesToUpdate.Count - 1);
                scene.Update(gameTime, othersceneHasFocus, coveredByOtherscene);

                if (scene.SceneState == SceneState.TransitionOn ||
                    scene.SceneState == SceneState.Active)
                {
                    if (!othersceneHasFocus)
                    {
                        scene.HandleInput();
                        othersceneHasFocus = true;
                    }

                    if (!scene.IsPopup)
                    {
                        coveredByOtherscene = true;
                    }
                }
            }
        }