Exemple #1
0
        /// <summary>
        /// Updates the player when no-clip is disabled.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        private void UpdateClip(GameTime gameTime)
        {
            if (HandleInput)
            {
                // if this is the first time, we need to center the mouse
                if (_isFirstUpdate)
                {
                    Game.Instance.CenterMouse();
                    _currMouse     = _lastMouse = Mouse.GetState();
                    _isFirstUpdate = false;
                }

                // process input
                ProcessInput(gameTime);
            }

            // update camera and apply physics irregardless of input handling
            _camera.Update(gameTime);
            ApplyPhysics(gameTime);
        }
Exemple #2
0
        /// <summary>
        /// Disables no-clip.
        /// </summary>
        private void DisableNoClip()
        {
            var fc = _camera as FreeCamera;
            _position = fc.Position;
            _position.Y -= PlayerSizeY / 3.0f;

            _camera = PlayerCamera.FromFreeCamera( fc, this );
            _camera.Update( null );

            _isNoClipEnabled = false;
        }