Beispiel #1
0
        public void Update(GameTime gameTime, GraphicsDeviceManager graphics)
        {
            UpdateInput();
            if (activarcamara == ActivarCamara.fps)
            {
                cameraSurface.UpdateInput(gameTime, graphics);
                view       = cameraSurface.view;
                projection = cameraSurface.projection;


                //tank.view = cameraSurfaceFollow.view;
                //tank.projection = cameraSurfaceFollow.projection;
            }
            else if (activarcamara == ActivarCamara.free)
            {
                cameraAula.UpdateInput(gameTime, graphics);
                view        = cameraAula.view;
                projection  = cameraAula.projection;
                worldMatrix = cameraAula.worldMatrix;
                //tank.view = camera.view;
                //tank.projection = camera.projection;
            }
            else
            {
                //cameraSurfaceFollow.updateCamera();
                //cameraTank.UpdateInput(gameTime, graphics,tank.getPosition());
                cameraTank.updateCamera(tank.getPosition(), tank.getWorldMAtrix(), tank.view, tank);
                view        = cameraTank.view;
                projection  = cameraTank.projection;
                worldMatrix = cameraTank.worldMatrix;
            }
        }
Beispiel #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)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }


            escolherCamara();
            if (cameraAtiva == CameraAtiva.fps)
            {
                cameraSurfaceFollow.UpdateInput(gameTime, graphics);
            }
            else if (cameraAtiva == CameraAtiva.free)
            {
                camera.UpdateInput(gameTime, graphics);
            }
            else
            {
                cameraTank.updateCamera(tank.getPosition(), tank.getWorldMAtrix(), tank.view, tank);
            }
            tank.Update(gameTime, tank, listaTanques);
            tankEnimigo.Update(gameTime, tank, listaTanques);
            tankEnimigo2.Update(gameTime, tank, listaTanques);
            tankEnimigo3.Update(gameTime, tank, listaTanques);
            BulletManager.UpdateBalas(gameTime);

            colisionManager.UpdateColisions(tank);
            base.Update(gameTime);
        }