Ejemplo n.º 1
0
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            camera = new FirstPersonCamera(ScreenManager.GraphicsDevice.Viewport);
            level  = LevelCreator.CreateLevel(ScreenManager.Game, currentLevel);

            texture = content.Load <Texture2D>("title");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (Content == null)
            {
                Content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            switch (gameMode)
            {
            case NetworkSessionComponent.GameMode.DeathMatch:
                break;

            case NetworkSessionComponent.GameMode.TeamDeathmatch:
                break;

            case NetworkSessionComponent.GameMode.CaptureTheFlag:
                break;

            default:
                break;
            }

            this.audioManager = (AudioManager)ScreenManager.Game.Services.GetService(typeof(AudioManager));



            //Classes
            input   = new InputHelper();
            console = new ConsoleMenu(ScreenManager.Game);
            ScreenManager.Game.Components.Add(console);
            //FPS
            fpsCounter = new FrameRateCounter(ScreenManager.Game);
            ScreenManager.Game.Components.Add(fpsCounter);

            Mouse.SetPosition(0, 0);
            camera = new FirstPersonCamera(ScreenManager.GraphicsDevice.Viewport);
            level  = LevelCreator.CreateLevel(ScreenManager.Game, currentLevel);
            //player = level.player;
            weapon = level.weapon;

            foreach (NetworkGamer gamer in networkSession.AllGamers)
            {
                Player player = gamer.Tag as Player;

                if (player.TeamID == 1)
                {
                    player.Initialize(ModelTypes.PlayerType.TankGirl, ModelTypes.RedTeamSpawnPoint[(int)currentLevel], ModelTypes.RedTeamSpawnRotation[(int)currentLevel], new Vector3(0, 5, 0), level.world, level.weapon);
                    //player.Initialize(ModelTypes.PlayerType.TankGirl, redTeamSpawnPoint, redTeamSpawnRotation, new Vector3(0, 5, 0), level.world, level.weapon);
                }
                else
                {
                    player.Initialize(ModelTypes.PlayerType.TankGirl, ModelTypes.BlueTeamSpawnPoint[(int)currentLevel], ModelTypes.BlueTeamSpawnRotation[(int)currentLevel], new Vector3(0, 5, 0), level.world, level.weapon);
                }
                //player.Initialize(ModelTypes.PlayerType.TankGirl, blueTeamSpawnPoint, blueTeamSpawnRotation, new Vector3(0, 5, 0), level.world, level.weapon);
            }

            if (networkSession.LocalGamers.Count > 0)
            {
                localPlayer = networkSession.LocalGamers[0].Tag as Player;
            }

            #region HUD
            //HUD
            hud = new HUD(ScreenManager.Game, localPlayer, weapon.BulletsCount, weapon.MaxBullets, ScreenManager.Game.Content, ScreenManager.SpriteBatch);
            ScreenManager.Game.Components.Add(hud);
            messageList = hud.messageList;

            playerMessage.title    = "p";
            playerMessage.font     = ScreenManager.Font;
            playerMessage.position = new Vector2(100, 527);
            playerMessage.text     = "Player Score :" + PlayerScore.ToString();
            playerMessage.color    = Color.Red;
            messageList.Add(playerMessage);

            enemyMessage.title    = "e";
            enemyMessage.font     = ScreenManager.Font;
            enemyMessage.position = new Vector2(100, 554);
            enemyMessage.color    = Color.Blue;
            enemyMessage.text     = "Enemy Score :" + enemyScore.ToString();
            messageList.Add(enemyMessage);

            bulletAmountMessage.title    = "b";
            bulletAmountMessage.font     = ScreenManager.Font;
            bulletAmountMessage.position = new Vector2(800, 554);
            bulletAmountMessage.color    = Color.White;
            bulletAmountMessage.text     = "Pistol :" + weapon.BulletsCount + "/" + weapon.MaxBullets;
            messageList.Add(bulletAmountMessage);
            #endregion

            string filename = Environment.CurrentDirectory + "GameVariables";
            OpenFile(filename);



            #region unused - speed up loading time
            //person2.Position = new Vector3(0, 15, -30);
            //bulletAmount = maxBullets;
            //ScreenManager.Game.Components.Add(awards = new AwardsComponent(ScreenManager.Game));
            //audioHelper = new Audio("Content\\TRA_Game.xgs");
            //famas_1 = audioHelper.GetCue("famas-1");
            //famas_forearm = audioHelper.GetCue("famas_forearm");
            //person2 = new DrawableModel(Content.Load<Model>("Models//model"), Matrix.Identity);
            //pistol = new DrawableModel(Content.Load<Model>("Models//pistol(1)"), Matrix.Identity);
            //awards = new AwardsComponent(ScreenManager.Game);
            //shootAward = new Award { Name = "Shoot!", TextureAssetName = "award-1", ProgressNeeded = 10 };
            //shootAward.LoadTexture(Content);
            //awards.Awards.Add(shootAward);
            #endregion
        }