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); }
public TargetBuildHelper(GameContent content, int viewWidth, int viewHeight, SpriteBatch sb) { _randomGenerator = new Random(); _content = content; _viewWidth = viewWidth; _viewHeight = viewHeight; _spriteBatch = sb; GenerateTargetArrays(); }
public RoundManager(Vector2 textPosition, Player player1, Player player2, GameContent content, SpriteBatch sb, FlyingObjectManager flyingObjMgr) { _textPosition = textPosition; _player1 = player1; _player2 = player2; _font = content.GameFont; _spriteBatch = sb; _flyingObjMgr = flyingObjMgr; }
public Player(Vector2 scorePosition, int playerNumber, GameContent content, Point gunCasePos, int viewWidth, int viewHeight, SpriteBatch sb, FlyingObjectManager flyingObjMgr, AudioManager audioManager) { _scoreTextPosition = scorePosition; _playerName = "Player " + playerNumber.ToString(); _playerNumber = playerNumber; _font = content.GameFont; _spriteBatch = sb; _gun = CreateGun(content, gunCasePos, viewWidth, viewHeight, flyingObjMgr, audioManager); _bridgeTex = content.Bridge; _bridgeRect = new Rectangle((int)_scoreTextPosition.X + 140, (int)_scoreTextPosition.Y, 40, 20); }
public AudioManager(GameContent gameContent) { _gunShot = gameContent.GunShot; _explosion2 = gameContent.Explosion2; _barrelExploding = gameContent.BarrelExplosion; _bridgeExplosion = gameContent.BridgeExplosion; _walking = gameContent.Advancing.CreateInstance(); _walking.IsLooped = true; _walking.Volume = 0.3f; _ascending = gameContent.Ascending.CreateInstance(); _ascending.IsLooped = true; _ascending.Volume = 0.4f; _falling = gameContent.Falling.CreateInstance(); _falling.IsLooped = false; _backgroundSounds = new List<SoundEffectInstance>(); var cave = gameContent.BackgroundCave.CreateInstance(); cave.IsLooped = true; cave.Volume = 0.4f; _backgroundSounds.Add(cave); var mazy = gameContent.BackgroundMazyJungle.CreateInstance(); mazy.IsLooped = true; mazy.Volume = 0.4f; _backgroundSounds.Add(mazy); var rescue = gameContent.BackgroundRescue.CreateInstance(); rescue.IsLooped = true; rescue.Volume = 0.4f; _backgroundSounds.Add(rescue); var stable = gameContent.BackgroundStableBoy.CreateInstance(); stable.IsLooped = true; stable.Volume = 0.4f; _backgroundSounds.Add(stable); var tunnels = gameContent.BackgroundTunnels.CreateInstance(); tunnels.IsLooped = true; tunnels.Volume = 0.4f; _backgroundSounds.Add(tunnels); }
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(); }
private Gun CreateGun(GameContent content, Point gunCasePos, int viewWidth, int viewHeight, FlyingObjectManager flyingObjMgr, AudioManager audioManager) { if (_playerNumber == 1) { return new Gun(gunCasePos.X, gunCasePos.Y, content, Keys.A, Keys.D, Keys.S, this, viewWidth, viewHeight, _spriteBatch, flyingObjMgr, audioManager); } else { return new Gun(gunCasePos.X, gunCasePos.Y, content, Keys.NumPad4, Keys.NumPad6, Keys.NumPad5, this, viewWidth, viewHeight, _spriteBatch, flyingObjMgr, audioManager); } }