public FlyingObjectManager(TargetBuildHelper targetBuildHelper, SpriteBatch sb, Texture2D particle, int viewWidth, int viewHeight, AudioManager audioManager) { _bulletList = new List<Bullet>(); _targetList = new List<TargetObject>(); _bulletsToRemove = new List<Bullet>(); _targetsToRemove = new List<TargetObject>(); _explosionList = new List<Explosion>(); _explosionToRemove = new List<Explosion>(); _targetBuildHelper = targetBuildHelper; _spriteBatch = sb; _particle = particle; _viewWidth = viewWidth; _viewHeight = viewHeight; _audioManager = audioManager; }
protected override void Initialize() { _spriteBatch = new SpriteBatch(GraphicsDevice); _isPaused = false; _gameContent = new GameContent(Content, GraphicsDevice); _audioManager = new AudioManager(_gameContent); int ht = _graphics.GraphicsDevice.Viewport.Height; int wt = _graphics.GraphicsDevice.Viewport.Width; float heightRatio = HEIGHT / (float)ht; float widthRatio = WIDTH / (float)wt; _backgroundRect = new Rectangle(0, 0, wt, ht); TargetBuildHelper targetHelper = new TargetBuildHelper(_gameContent, wt, ht, _spriteBatch); _flyingObjManager = new FlyingObjectManager(targetHelper, _spriteBatch, _gameContent.Particle, wt, ht, _audioManager); int gunCaseX = (int)(350 * widthRatio); int gunCaseY = (int)(600 * heightRatio); //black line is at 630 _gunCaseLeftRect = new Rectangle(gunCaseX, gunCaseY, 60, 30); _gunCaseRightRect = new Rectangle(wt - gunCaseX - 60, gunCaseY, 60, 30); _player1 = new Player(new Vector2(10, ht - 50), 1, _gameContent, new Point(gunCaseX, gunCaseY), wt, ht, _spriteBatch, _flyingObjManager, _audioManager); _player2 = new Player(new Vector2(wt - 190, ht - 50), 2, _gameContent, new Point(wt - gunCaseX - 60, gunCaseY), wt, ht, _spriteBatch, _flyingObjManager, _audioManager); _roundManager = new RoundManager(new Vector2(wt / 2 - 100, ht - 50), _player1, _player2, _gameContent, _spriteBatch, _flyingObjManager); _player1Animation = new AnimationManager(_player1, _gameContent, _spriteBatch, _roundManager, _audioManager); _player2Animation = new AnimationManager(_player2, _gameContent, _spriteBatch, _roundManager, _audioManager); _centeredPromptRect = new Rectangle(340, 200, 600, 300); _winMessage = new Rectangle(520, 570, _gameContent.Player1Won.Width, _gameContent.Player1Won.Height); _roundMessage = new Rectangle(520, 570, _gameContent.RoundStarting.Width, _gameContent.RoundStarting.Height); _audioManager.StartBackground(); base.Initialize(); }