public void Update(double elapsedTime, double gameTime)
        {
            _effectsManager.Update(elapsedTime);
            _playerCharacter.Update(elapsedTime);

            _background.Update((float)elapsedTime);
            _backgroundLayer.Update((float)elapsedTime);

            UpdateCollisions();
            //_enemyList.ForEach(x => x.Update(elapsedTime));
            _enemyManager.Update(elapsedTime, gameTime);
            _bulletManager.Update(elapsedTime);

            UpdateInput(elapsedTime);
        }
Ejemplo n.º 2
0
        public void Update(double elapsedTime, double gameTime)
        {
            _playerCharacter.Update(elapsedTime);
            _effectsManager.Update(elapsedTime);

            _background.Update((float)elapsedTime);
            _backgroundLayer.Update((float)elapsedTime);

            _enemyManager.Update(elapsedTime, gameTime);

            UpdateCollisions();
            _bulletManager.Update(elapsedTime);
            _gameData.Score = _playerCharacter.Score;
            _gameData.Lives = _playerCharacter.Lives;
            UpdateInput(elapsedTime);

            if (_enemyManager.HasEnemies())
            {
                if (_background_music == null || !_soundManager.IsSoundPlaying(_background_music))
                {
                    _background_music = _soundManager.PlaySound("level_background", true);
                }
            }
            else
            {
                if (_background_music != null && _soundManager.IsSoundPlaying(_background_music))
                {
                    _soundManager.StopSound(_background_music);
                }

                _endingTime -= elapsedTime;

                if (_endingTime < 0)
                {
                    Finished = true;
                }
            }


            if (_playerCharacter.IsDead)
            {
                if (_background_music != null && _soundManager.IsSoundPlaying(_background_music))
                {
                    _soundManager.StopSound(_background_music);
                }
            }
        }