示例#1
0
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            spriteBatch = new SpriteBatch(ScreenManager.GraphicsDevice);

            //Load up the players based on connected controllers
            for (int i = 0; i < 4; i++)
            {
                if (GamePad.GetState((PlayerIndex)i).IsConnected)
                {
                    playerManager.AddPlayer((PlayerIndex)i);
                }
            }

            //If there are no connected controllers
            if (playerManager.playerList.Count == 0)
            {
                //Still add Player 1 -- he'll use the keyboard!
                playerManager.AddPlayer(PlayerIndex.One);
                playerManager.AddPlayer(PlayerIndex.Two);
            }

            //Set the initial positions of the players.
            playerManager.SetInitialPositions();
            //Initialize the system-wide number of players
            Defines.NUM_PLAYERS = playerManager.playerList.Count;

            base.LoadContent();
        }
示例#2
0
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            spriteBatch = new SpriteBatch(ScreenManager.GraphicsDevice);

            //Load up the players based on connected controllers
            for (int i = 0; i < 4; i++)
            {
                if (GamePad.GetState((PlayerIndex)i).IsConnected)
                {
                    playerManager.AddPlayer((PlayerIndex)i);
                }
            }

            //If there are no connected controllers
            if (playerManager.playerList.Count == 0)
            {
                //Still add Player 1 -- he'll use the keyboard!
                playerManager.AddPlayer(PlayerIndex.One);
                playerManager.AddPlayer(PlayerIndex.Two);
            }

            //Set the initial positions of the players.
            playerManager.SetInitialPositions();
            //Initialize the system-wide number of players
            Defines.NUM_PLAYERS = playerManager.playerList.Count;

            //Load enemies and their initial attributes
            for (int i = 0; i < NUM_ENEMIES; i++)
            {
                //Add the enemy to the sprite manager
                enemySpriteManager.spriteList.Add(new Pawn(ScreenManager.Game));
            }

            //Once the load has finished, we use ResetElapsedTime to tell the game's
            //timing mechanism that we have just finished a very long frame, and that
            //it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();

            base.LoadContent();
        }