Пример #1
0
        /// <summary>
        /// Allows the page to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        private void OnUpdate(object sender, GameTimerEventArgs e)
        {
            GameTime gameTime = new GameTime(e.TotalTime, e.ElapsedTime);

            if (!Global.loaded && !Global.loading)
            {
                Global.loading = true;
                if (spriteBatch == null)
                {
                    spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);
                }
                LoadBar();
                Load(Deployment.Current.Dispatcher);
            }
            if (load != null && Global.loading)
            {
                load.Update(gameTime);
            }
            if (intro != null && !Global.loading)
            {
                if (scene.kind == Scene.LOAD)
                {
                    intro.Initialize();
                    action.Initialize();
                    editor.Initialize();
                    input.pad.Initialize();

                    SwitchScenes(Scene.INTRO);
                }
                input.Update();
                scene.Update(gameTime);
                if (scene.kind == Scene.INTRO)
                {
                    SwitchScenes(Scene.ACTION);
                }
            }
            fps = 1000 / e.ElapsedTime.Milliseconds;
        }