Esempio n. 1
0
        public void Update(GameTime gameTime)
        {
            _endGameTimer.Update(gameTime);

            if (_endGame)
            {
                return;
            }

            foreach (var bullet in _bullets)
            {
                bullet.Update(gameTime);
            }

            foreach (var laser in _lasers)
            {
                laser.Update(gameTime);
            }

            MoverManager.Update();
            CollisionWorld.Update(gameTime);
            ParticleManager.Update(gameTime);

            _bullets.RemoveAll(b => !b.Used);
        }
Esempio n. 2
0
        public void Update(GameTime gameTime)
        {
            if (!EndGame() || (GameIsFinished() || TransitioningToEndGame()))
            {
                MoverManager.Update();
            }

            if (!_ready)
            {
                return;
            }

            _cameraZoomTimer.Update(gameTime);
            _explosionTimer.Update(gameTime);

            if (_boss != null && (!EndGame() || (GameIsFinished() || TransitioningToEndGame())))
            {
                _boss.Update(gameTime);
            }

            if (!EndGame() || (GameIsFinished() || TransitioningToEndGame()))
            {
                foreach (var bullet in _bullets)
                {
                    bullet.Update(gameTime);
                }

                _bullets.RemoveAll(b => !b.Used);

                foreach (var laser in _lasers)
                {
                    laser.Update(gameTime);
                }

                ParticleManager.Update(gameTime);
            }

            if (GameIsFinished())
            {
                return;
            }

            _playTime += gameTime.ElapsedGameTime;

            if (_boss != null && _boss.IsReady() && !EndGame())
            {
                _timer += gameTime.ElapsedGameTime;
            }

            CollisionWorld.Update(gameTime);

            _player.Update(gameTime);
        }
Esempio n. 3
0
        protected override void Update(GameTime gameTime)
        {
            var deltaSeconds  = (float)gameTime.ElapsedGameTime.TotalSeconds;
            var keyboardState = Keyboard.GetState();

            //var mouseState = Mouse.GetState();

            //_mousePoint = _camera.ScreenToWorld(new Vector2(mouseState.X, mouseState.Y)).ToPoint();

            // camera
            if (keyboardState.IsKeyDown(Keys.R))
            {
                _camera.ZoomIn(deltaSeconds);
            }

            if (keyboardState.IsKeyDown(Keys.F))
            {
                _camera.ZoomOut(deltaSeconds);
            }

            // zombie
            if (keyboardState.IsKeyDown(Keys.Left))
            {
                _zombie.Walk(-1.0f);
            }

            if (keyboardState.IsKeyDown(Keys.Right))
            {
                _zombie.Walk(1.0f);
            }

            if (keyboardState.IsKeyDown(Keys.Space))
            {
                _zombie.Attack();
            }

            if (keyboardState.IsKeyDown(Keys.Up))
            {
                _zombie.Jump();
            }

            if (keyboardState.IsKeyDown(Keys.Enter))
            {
                _zombie.Die();
            }

            // update must be called before collision detection
            _zombie.Update(gameTime);
            _world.Update(gameTime);
            _camera.LookAt(_zombie.Position);

            base.Update(gameTime);
        }