/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { gameState = GameState.TitleScreen; spriteBatch = new SpriteBatch(GraphicsDevice); backGroundMusic = new BackgroundMusic(Content, BackgroundMusic.playAt.Level1); startScreen = new StartScreen(graphics, spriteBatch, Content); fadeScreen = new FadeScreen(graphics); enemies = new List<Sprite>(); explosions = new List<AnimatedSprite>(); collisions = new Collisions(Content, explosions); input = new KeyboardInput(); padInput = new GamepadInput(); hbOne = new HealthBar(Content, graphics, new Vector2(50, graphics.PreferredBackBufferHeight - 125)); cbOne = new ChargeMeter(Content, graphics, new Vector2(50, graphics.PreferredBackBufferHeight - 75)); meterLabel = Content.Load<Texture2D>("Images/meter-labels"); playerOneMeterTitle = Content.Load<Texture2D>("Images/meter-player-one"); playerTwoMeterTitle = Content.Load<Texture2D>("Images/meter-player-two"); playerOneMarker = Content.Load<Texture2D>("Images/P1-Marker"); playerTwoMarker = Content.Load<Texture2D>("Images/P2-Marker"); bossLifeBar = new HealthBar(Content, graphics, new Vector2(graphics.PreferredBackBufferWidth / 2 - 140, 50)); bossLifeBar.IsVisible = false; font = Content.Load<SpriteFont>("Font"); levelCreator = new LevelCreator(Content); pauseScreen = new PauseScreen(graphics, Content); creditScreen = new CreditScreen(graphics, Content); }
/// <summary> /// UnloadContent will be called once per game and is the place to unload /// all content. /// </summary> protected override void UnloadContent() { gameState = GameState.TitleScreen; previousState = gameState; upgradeScreen = null; startScreen = null; characterScreen = null; multiplayerLobby = null; deathScreen = null; levelBeginning = null; pauseScreen = null; loadingScreen = null; levelCreator = null; Random rand = new Random(); currentLevel = null; enemies = null; explosions = null; shotBehavior = null; enemyShots = null; playerShots = null; hbOne = null; hbTwo = null; bossLifeBar = null; cbOne = null; cbTwo = null; backGroundMusic = null; playerOneMeterTitle = null; playerTwoMeterTitle = null; meterLabel = null; playerOneMarker = null; playerTwoMarker = null; dinosaurOne = null; dinosaurTwo = null; playerOneSprite = null; playerTwoSprite = null; collisions = null; font = null; playerOneCounter = 0; playerTwoCounter = 0; levelIncrement = 0; singlePlayer = false; explodedOne = false; explodedTwo = false; input = null; padInput = null; }
private void ValidateCharacter(int player) { if (player == 1) { if (dinosaurOne.dinoChosen == Player.Chara.Bronto) { playerOneSprite = new AnimatedSprite(12, 0, 0, 38, 183, this, dinosaurOne.Image, dinosaurOne.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } else if (dinosaurOne.dinoChosen == Player.Chara.Trex) { playerOneSprite = new AnimatedSprite(12, 0, 0, 69, 181, this, dinosaurOne.Image, dinosaurOne.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } else if (dinosaurOne.dinoChosen == Player.Chara.Ptera) { playerOneSprite = new AnimatedSprite(7, 0, 0, 195, 118, this, dinosaurOne.Image, dinosaurOne.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } else if (dinosaurOne.dinoChosen == Player.Chara.Cera) { playerOneSprite = new AnimatedSprite(7, 0, 0, 62, 175, this, dinosaurOne.Image, dinosaurOne.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } } else if (player == 2) { if (dinosaurTwo.dinoChosen == Player.Chara.Bronto) { playerTwoSprite = new AnimatedSprite(12, 0, 0, 38, 183, this, dinosaurTwo.Image, dinosaurTwo.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } else if (dinosaurTwo.dinoChosen == Player.Chara.Trex) { playerTwoSprite = new AnimatedSprite(12, 0, 0, 69, 181, this, dinosaurTwo.Image, dinosaurTwo.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } else if (dinosaurTwo.dinoChosen == Player.Chara.Ptera) { playerTwoSprite = new AnimatedSprite(7, 0, 0, 195, 118, this, dinosaurTwo.Image, dinosaurTwo.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } else if (dinosaurTwo.dinoChosen == Player.Chara.Cera) { playerTwoSprite = new AnimatedSprite(7, 0, 0, 62, 175, this, dinosaurTwo.Image, dinosaurTwo.Position, spriteBatch, new EnemyType(Content, EnemyType.Etype.Player)); } hbTwo = new HealthBar(Content, graphics, new Vector2(graphics.PreferredBackBufferWidth - 330, graphics.PreferredBackBufferHeight - 125)); cbTwo = new ChargeMeter(Content, graphics, new Vector2(graphics.PreferredBackBufferWidth - 330, graphics.PreferredBackBufferHeight - 75)); } }