Example #1
0
        /// <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;
        }
Example #2
0
        protected void LoadCharacter()
        {
            if (startScreen.SinglePlayer)
            {
                singlePlayer = true;
                dinosaurOne = new Player(Content, graphics, characterScreen.Character, 1);
                dinosaurOne.ControlScheme = startScreen.ControlScheme;

                ValidateCharacter(1);

                playerOneSprite.Position = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight - 250);
            }
            else if (startScreen.MultiPlayer)
            {
                singlePlayer = false;
                dinosaurOne = new Player(Content, graphics, multiplayerLobby.playerOne, 1);
                dinosaurTwo = new Player(Content, graphics, multiplayerLobby.playerTwo, 2);
                dinosaurOne.ControlScheme = multiplayerLobby.firstPlayerControl;
                dinosaurTwo.ControlScheme = multiplayerLobby.secondPlayerControl;

                ValidateCharacter(1);
                ValidateCharacter(2);

                playerOneSprite.Position = new Vector2(graphics.PreferredBackBufferWidth / 3, graphics.PreferredBackBufferHeight - 250);
                playerTwoSprite.Position = new Vector2(graphics.PreferredBackBufferWidth - (graphics.PreferredBackBufferWidth / 3), graphics.PreferredBackBufferHeight - 250);
            }

            playerShots = new PlayerShots(Content, dinosaurOne, playerOneSprite, dinosaurTwo, playerTwoSprite);
            shotBehavior = new ShotBehavior(Content);
            enemyShots = new EnemyShots(Content);

            CreateScreens();
            GenerateLevel();
        }