Exemplo n.º 1
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)
        {
            screenManager.Update(gameTime);
            frameRateCounter.Update(gameTime);

            base.Update(gameTime);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Updates the specified game time.
 /// </summary>
 /// <param name="gameTime">The game time.</param>
 public void Update(GameTime gameTime)
 {
     _camera.Update(gameTime);
     _buildMenuManager.Update(gameTime);
     _npcManager.Update(gameTime);
     _playingStateInterface.Update(gameTime);
     _jobManager.Update(gameTime);
     _mouseManager.Update(gameTime);
     _frameRateCounter.Update(gameTime);
 }
Exemplo n.º 3
0
        protected override void UpdateAsync()
        {
            _frameRateCounter.Update();
            if (IsActive)
            {
                UI.Update();
            }

            if (!UI.IsPaused)
            {
                Room.Update();
                Room.Draw();
                ProcessManager.Draw();
            }
            Room.Camera.EndDrawing();
        }
Exemplo n.º 4
0
        //Update and draw
        protected override void Update(GameTime gameTime)
        {
            //Save the game time
            Time.Update(gameTime);

            //Update X
            X.Update(gameTime);

            //Update all components
            InputManager.Update();
            GameConsole.Update();
            AchievementHolder.Update();
            FrameRateCounter.Update();
            Timer.UpdateAll();
            Stopwatch.UpdateAll();

            base.Update(gameTime);
        }
Exemplo n.º 5
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            Globals.CharacterComparisonPointForMouseControlVector = Player.PositionOnScreen;

            FrameRateCounter.Update(gameTime);


            if (InputManager.IsButtonPressed(Keys.O))
            {
                IsKrypton = !IsKrypton;
            }

            base.Update(gameTime);
        }
Exemplo n.º 6
0
        /// <summary>Allows each screen to run logic.</summary>
        protected override void Update(GameTime gameTime)
        {
            // Read the keyboard and gamepad.
            _input.Update(gameTime);

#if WINDOWS
            // Update the framerate counter
            _counter.Update(gameTime);
#endif

            if ((_input.IsNewButtonPress(Buttons.Y) || _input.IsNewKeyPress(Keys.F5)) && _screenManager.LastScreen is not OptionsScreen)
            {
                _screenManager.AddScreen(new OptionsScreen());
            }

#if WINDOWS
            if (_input.IsNewKeyPress(Keys.F11))
            {
                _showFps = !_showFps;
            }

            if (_input.IsNewKeyPress(Keys.F12))
            {
                _graphics.ToggleFullScreen();
            }
#endif

            _screenManager.Update(gameTime);

            if (_isExiting && _screenManager.ScreenCount == 0)
            {
                Exit();
            }

            base.Update(gameTime);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Allows each screen to run logic.
        /// </summary>
        protected override void Update(GameTime gameTime)
        {
            // Read the keyboard and gamepad.
            _input.Update(gameTime);
            // Update the framerate counter
#if WINDOWS
            _counter.Update(gameTime);
#endif
            if ((_input.IsNewButtonPress(Buttons.Y) || _input.IsNewKeyPress(Keys.F5)) && !(_screens[_screens.Count - 1] is OptionsScreen))
            {
                AddScreen(new OptionsScreen());
            }
#if WINDOWS
            if (_input.IsNewKeyPress(Keys.F11))
            {
                _showFPS = !_showFPS;
            }

            if (_input.IsNewKeyPress(Keys.F12))
            {
                _graphics.ToggleFullScreen();
            }
#endif
            // Make a copy of the master screen list, to avoid confusion if
            // the process of updating one screen adds or removes others.
            _screensToUpdate.Clear();
            _screensToUpdate.AddRange(_screens);

            bool otherScreenHasFocus  = !IsActive;
            bool coveredByOtherScreen = false;

            // Loop as long as there are screens waiting to be updated.
            while (_screensToUpdate.Count > 0)
            {
                // Pop the topmost screen off the waiting list.
                GameScreen screen = _screensToUpdate[_screensToUpdate.Count - 1];

                _screensToUpdate.RemoveAt(_screensToUpdate.Count - 1);

                // Update the screen.
                screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

                if (screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active)
                {
                    // If this is the first active screen we came across,
                    // give it a chance to handle input.
                    if (!otherScreenHasFocus && !_isExiting)
                    {
                        _input.ShowCursor = screen.HasCursor;
                        screen.HandleInput(_input, gameTime);
                        otherScreenHasFocus = true;
                    }

                    // If this is an active non-popup, inform any subsequent
                    // screens that they are covered by it.
                    if (!screen.IsPopup)
                    {
                        coveredByOtherScreen = true;
                    }
                }
            }

            if (_isExiting && _screens.Count == 0)
            {
                Exit();
            }

            base.Update(gameTime);
        }
Exemplo n.º 8
0
Arquivo: Game1.cs Projeto: sin-us/sdhk
        /// <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)
        {
            // TODO: Add your update logic here
            FrameRateCounter.Update(gameTime);
            KeyboardManager.Update();
            MouseManager.Update();

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                this.Exit();
            }
            if (InputConfigManager.IsKeyBindingPressed(ActionType.Exit))
            {
                this.Exit();
            }

            // Toggle keybindings hint
            if (InputConfigManager.IsKeyBindingPressed(ActionType.ToggleKeybindingsHint))
            {
                isKeybindingsHintShown = !isKeybindingsHintShown;
            }

            // Toggle wireframe mode
            if (InputConfigManager.IsKeyBindingPressed(ActionType.ToggleWireframe))
            {
                isWireFrame = !isWireFrame;
            }

            RasterizerState rasterizerState = new RasterizerState();

            if (isWireFrame == true)
            {
                rasterizerState.FillMode = FillMode.WireFrame;
            }
            else
            {
                rasterizerState.FillMode = FillMode.Solid;
            }
            GraphicsDevice.RasterizerState = rasterizerState;

            // Framerate handling
            if (InputConfigManager.IsKeyBindingPressed(ActionType.ToggleFixedFramerate))
            {
                graphics.SynchronizeWithVerticalRetrace = !graphics.SynchronizeWithVerticalRetrace;
                this.IsFixedTimeStep = !this.IsFixedTimeStep;
                graphics.ApplyChanges();
            }

            // Fullscreen handling
            if (InputConfigManager.IsKeyBindingPressed(ActionType.ToggleFullscreen))
            {
                graphics.IsFullScreen = !graphics.IsFullScreen;
                graphics.ApplyChanges();
            }

            HandleCameraInput();

            Ray mouseRay = CalculateRay(MouseManager.MouseStatus.Position.ToVector2(), camera.ViewMatrix, camera.ProjectionMatrix, _hexSphere.Effect.World, GraphicsDevice.Viewport);

            _hexSphere.CheckIntersection(ref mouseRay, out _hexSphereIntersectionChecksCount);


            _hexSphere.Update(gameTime, camera.Offset);
            drawablePlane.Update(camera.Offset);

            base.Update(gameTime);
        }