コード例 #1
0
ファイル: Game1.cs プロジェクト: damian-666/GameDevelopment
        protected override void Update(GameTime gameTime)
        {
            Sound.Update();
            Music.Play("music1");
            QuakeManager.Update();
            ControlInput.Update();

            FrameTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (SlowTime > 0f)
            {
                SlowTime  -= FrameTime;
                FrameTime /= 10f;
            }

            switch (GameMode)
            {
            case GameModes.Playing:
                UpdateGame();
                break;

            case GameModes.Menu:
                if (Menu.MenuMode == MenuMode.Dead)
                {
                    var pTime = FrameTime;
                    FrameTime /= 3f;
                    UpdateGame();
                    FrameTime = pTime;
                }
                Menu.Update(this);
                break;
            }

            base.Update(gameTime);
        }
コード例 #2
0
        /// <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)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            Sound.Update();
            Music.Play("music1");
            QuakeManager.Update();

            frameTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
            NetPlay.NetGame.FrameTime = FrameTime;

            frameTime *= 1.5f;

            if (SlowTime > 0f)
            {
                SlowTime  -= FrameTime;
                frameTime /= 10f;
            }

            NetPlay.Update(character, pManager);
            store.Update();

            switch (gameMode)
            {
            case GameModes.Playing:
                UpdateGame();

                break;

            case GameModes.Menu:
                if (menu.menuMode == Menu.MenuMode.Dead)
                {
                    float pTime = FrameTime;
                    frameTime /= 3f;
                    UpdateGame();

                    frameTime = pTime;
                }
                menu.Update(this);
                break;
            }

            base.Update(gameTime);
        }