Exemplo n.º 1
0
 public override void Update(GameTime gameTime)
 {
     _cameraController.Update(gameTime);
     Game.Camera.Update(gameTime);
     _player.Update(gameTime);
     _game.GameClient.World.Update(gameTime);
     _blockPicker.Update(gameTime);
     _weaponManager.Update(gameTime);
 }
Exemplo n.º 2
0
        public void Update(GameTime gameTime)
        {
            Matrix previousView = camera.View;

            if (freeCam)
            {
                cameraController.ProcessInput(gameTime);
                player.position = camera.Position;
            }

            cameraController.Update(gameTime);

            camera.Update(gameTime);

            //Do not change methods order, its not very clean but works fine
            if (!freeCam)
            {
                physics.move(gameTime);
            }

            //do not do this each tick
            if (!previousView.Equals(camera.View))
            {
                lookVector = camera.LookVector;
                lookVector.Normalize();

                bool  waterSelectable = false;
                float x = setPlayerSelectedBlock(waterSelectable);
                if (x != 0) // x==0 is equivalent to payer.currentSelection == null
                {
                    setPlayerAdjacentSelectedBlock(x);
                }
            }

            MouseState mouseState = Mouse.GetState();

            int scrollWheelDelta = previousMouseState.ScrollWheelValue - mouseState.ScrollWheelValue;

            if (mouseState.RightButton == ButtonState.Pressed &&
                previousMouseState.RightButton != ButtonState.Pressed)
            {
                player.RightTool.Use();
            }

            if (mouseState.LeftButton == ButtonState.Pressed &&
                previousMouseState.LeftButton != ButtonState.Pressed)
            {
                player.LeftTool.Use();
            }

            player.RightTool.switchType(scrollWheelDelta);
            player.LeftTool.switchType(scrollWheelDelta);

            previousMouseState = Mouse.GetState();
        }