public AnimationManager(Player player, GameContent content, SpriteBatch spriteBatch, RoundManager roundManager, AudioManager audioManager) { _player = player; _roundManager = roundManager; _spriteBatch = spriteBatch; _audioManager = audioManager; _charTex = content.Luigi; _lift = content.Lift; _font = content.GameFont; _bridge = content.Bridge; _lineTex = content.LineTexture; SetPlayerRectanglesAndColor(); _textPosition = new Vector2(); _liftRect1 = new Rectangle(1148, 528, 90, 20); _liftRect2 = new Rectangle(43, 400, 90, 20); _liftRect3 = new Rectangle(1148, 270, 90, 20); _lineRect1 = new Rectangle(); _lineRect2 = new Rectangle(); _lineRect3 = new Rectangle(); CreateAndUpdateAnimationStates(); this.AnimationIsCompleted = true; _charOrigin = new Vector2(); _bridge1Rect = new Rectangle(309, 392, 30, 30); _bridge2Rect = new Rectangle(869, 263, 30, 30); }
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(); }