/// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            mSpriteBatch = new SpriteBatch(GraphicsDevice);

            // Add any objects desired to the Game Object Factory.  These will be allocated now and can
            // be retrived later without any heap allocations.
            //
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Characters\\Scout\\Scout", 32);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Effects\\BulletSpark\\BulletSpark", 32);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Effects\\Dust\\Dust", 10);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Effects\\Explosion\\Explosion", 10);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Environments\\WallWood\\WallWood", 600);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Environments\\WallStone\\WallStone", 600);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Environments\\WallSteel\\WallSteel", 600);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Environments\\FloorSafeHouse\\FloorSafeHouse", 400);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Bullet\\Bullet", 100);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\RifleBullet\\RifleBullet", 100);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Grenade\\Grenade", 10);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Flare\\Flare", 10);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\WoodPickup\\WoodPickup", 100);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\StonePickup\\StonePickup", 100);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\SteelPickup\\SteelPickup", 100);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\DetectorPickup\\DetectorPickup", 100);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\GunTurretPickup\\GunTurretPickup", 100);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Detector\\Detector", 600);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\GunTurret\\GunTurret", 600);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Interface\\ButtonHint\\ButtonHint", 4);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Interface\\ResearchProgressBar\\ResearchProgressBar", 4);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Interface\\CivilianPopup\\CivilianPopup", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Interface\\ScoutPopup\\ScoutPopup", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Interface\\MilitantPopup\\MilitantPopup", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Interface\\MedicPopup\\MedicPopup", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Interface\\EngineerPopup\\EngineerPopup", 1);

            // The tiled background image that travels will the player creating the illusion of
            // an infinite background image.
            GameObject bg = new GameObject();

            MBHEngine.Behaviour.Behaviour t = new InfiniteBG(bg, null);
            bg.AttachBehaviour(t);
            bg.pRenderPriority = 20;
            GameObjectManager.pInstance.Add(bg);

            // Create the level.
            WorldManager.pInstance.Initialize();

            // Debug display for different states in the game.  This by creating new behaviours, additional
            // stats can be displayed.
            GameObject debugStatsDisplay = new GameObject();

            MBHEngine.Behaviour.Behaviour fps = new MBHEngine.Behaviour.FrameRateDisplay(debugStatsDisplay, null);
            debugStatsDisplay.AttachBehaviour(fps);
            GameObjectManager.pInstance.Add(debugStatsDisplay);

            // The player himself.
            GameObject player = new GameObject("GameObjects\\Characters\\Player\\Player");

            GameObjectManager.pInstance.Add(player);

            // Cheat to start the player with some walls in their inventory.
            if (CommandLineManager.pInstance["CheatFillInventory"] != null)
            {
                Inventory.AddObjectMessage addObj = new Inventory.AddObjectMessage();
                for (Int32 i = 0; i < 25; i++)
                {
                    addObj.mObj_In = GameObjectFactory.pInstance.GetTemplate("GameObjects\\Environments\\WallWood\\WallWood");
                    player.OnMessage(addObj);

                    addObj.mObj_In = GameObjectFactory.pInstance.GetTemplate("GameObjects\\Environments\\WallStone\\WallStone");
                    player.OnMessage(addObj);

                    addObj.mObj_In = GameObjectFactory.pInstance.GetTemplate("GameObjects\\Environments\\WallSteel\\WallSteel");
                    player.OnMessage(addObj);
                }
            }

            // Store the player for easy access.
            GameObjectManager.pInstance.pPlayer = player;

            GameObject go = GameObjectFactory.pInstance.GetTemplate("GameObjects\\Items\\StonePickup\\StonePickup");

            go.pPosition = new Vector2(50, 50);
            GameObjectManager.pInstance.Add(go);

            for (Int32 i = 0; i < 16; i++)
            {
                GameObject chef = new GameObject("GameObjects\\Characters\\Civilian\\Civilian");
                chef.pPosX = 64;
                chef.pPosY = 64;
                GameObjectManager.pInstance.Add(chef);
            }

            //GameObject enemy = new GameObject("GameObjects\\Characters\\Kamikaze\\Kamikaze");
            //enemy.pPosition.X = 50;
            //enemy.pPosition.Y = 50;
            //GameObjectManager.pInstance.Add(enemy);

            // This GO doesn't need to exist beyond creation, so don't bother adding it to the GO Manager.
            new GameObject("GameObjects\\Utils\\RandEnemyGenerator\\RandEnemyGenerator");
            new GameObject("GameObjects\\Utils\\RandCivilianGenerator\\RandCivilianGenerator");
            new GameObject("GameObjects\\Utils\\RandMilitantGenerator\\RandMilitantGenerator");
            new GameObject("GameObjects\\Utils\\RandMedicGenerator\\RandMedicGenerator");
            new GameObject("GameObjects\\Utils\\RandEngineerGenerator\\RandEngineerGenerator");

            // The vingette effect used to dim out the edges of the screen.
            GameObject ving = new GameObject("GameObjects\\Interface\\Vingette\\Vingette");

#if SMALL_WINDOW
            ving.pScale = new Vector2(0.5f, 0.5f);
#endif
            GameObjectManager.pInstance.Add(ving);

            // Add the HUD elements.
            //
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\Interface\\HUD\\PlayerHealthBar\\PlayerHealthBar"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\Interface\\HUD\\PlayerScore\\PlayerScore"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\Interface\\HUD\\PlayerInventory\\PlayerInventory"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\Interface\\HUD\\MiniMap\\MiniMap"));

            DebugMessageDisplay.pInstance.AddConstantMessage("Game Load Complete.");
        }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Add any objects desired to the Game Object Factory.  These will be allocated now and can
            // be retrived later without any heap allocations.
            //
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Blood\\Blood", 4);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Dust\\Dust", 64);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Kabooom\\Kabooom", 4);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Sparks\\Sparks", 64);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\SparkEmitter\\SparkEmitter", 4);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Tutorial\\Faster\\Faster", 4);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\Items\\Tutorial\\Slower\\Slower", 4);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\CreditsButton\\CreditsButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\FacebookButton\\FacebookButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\FSMPauseScreen\\FSMPauseScreen", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\GoogleLeaderboardButton\\GoogleLeaderboardButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\HiScoreLabel\\HiScoreLabel", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\HitCountDisplay\\HitCountDisplay", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\HitCountDisplayRecord\\HitCountDisplayRecord", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\IndieDBButton\\IndieDBButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\LeaveCreditsButton\\LeaveCreditsButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\FSMMainMenu\\FSMMainMenu", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\EnduranceModeBG\\EnduranceModeBG", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\EnduranceModeDesc\\EnduranceModeDesc", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\EnduranceModeButton\\EnduranceModeButton", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\GoButton\\GoButton", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\ModeSelectBG\\ModeSelectBG", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\ModeSelectTitle\\ModeSelectTitle", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\ScoreAttackModeBG\\ScoreAttackModeBG", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\ScoreAttackModeButton\\ScoreAttackModeButton", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\MainMenu\\ModeSelect\\ScoreAttackModeDesc\\ScoreAttackModeDesc", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\NewHighScore\\NewHighScore", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\NumFont\\NumFont", 128);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\NumFontUI\\NumFontUI", 128);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\Options\\Tutorial\\Checkbox\\Checkbox", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\Options\\Tutorial\\Checkmark\\Checkmark", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\Options\\Tutorial\\Label\\Label", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\PauseAchievementsButton\\PauseAchievementsButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\PauseMainMenuButton\\PauseMainMenuButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\PauseQuitButton\\PauseQuitButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\PauseResumeButton\\PauseResumeButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\PauseTrialModePurchaseButton\\PauseTrialModePurchaseButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\PointDisplay\\PointDisplay", 32);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\RecentTrickDisplay\\RecentTrickDisplay", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\ScoreLabel\\ScoreLabel", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\ScoreSummary\\ScoreSummary", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\ScoreSummaryBG\\ScoreSummaryBG", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TapStart\\TapStart", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TrialModeLimit\\FSMTrialModeLimit\\FSMTrialModeLimit", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TrialModeLimit\\TrialModeWatermark\\TrialModeWatermark", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TrialModeLimit\\TrialModeInputDisabled\\TrialModeInputDisabled", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TrialModeLimit\\TrialModeLimitReached\\TrialModeLimitReached", 2);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TrialModeLimit\\TrialModeLimitReachedBG\\TrialModeLimitReachedBG", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TrialModeLimit\\TrialModePurchaseButton\\TrialModePurchaseButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\TrialModeLimit\\TrialModeEndGameButton\\TrialModeEndGameButton", 1);
            GameObjectFactory.pInstance.AddTemplate("GameObjects\\UI\\Tutorial\\TapToContinue\\TapToContinue", 1);

            // Add objects that exist from the moment the game starts.
            //
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\Items\\Court\\Court"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\Items\\Net\\Net"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\Credits\\Backdrop\\Backdrop"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\Credits\\BG\\BG"));
            //GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\Credits\\CKuklaButton\\CKuklaButton"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\Credits\\MHughsonButton\\MHughsonButton"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\Credits\\MImmonenButton\\MImmonenButton"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\Credits\\SMcGeeButton\\SMcGeeButton"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\Credits\\SPaxtonButton\\SPaxtonButton"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\GameOver\\GameOver"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\PauseButton\\PauseButton"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\PausedBackdrop\\PausedBackdrop"));
            GameObjectManager.pInstance.Add(new GameObject("GameObjects\\UI\\PausedOverlay\\PausedOverlay"));

            GameObject titleScreen = GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\MainMenu\\FSMMainMenu\\FSMMainMenu");
            GameObjectManager.pInstance.Add(titleScreen);

            GameObjectManager.pInstance.Add(GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\TrialModeLimit\\FSMTrialModeLimit\\FSMTrialModeLimit"));
            GameObjectManager.pInstance.Add(GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\TrialModeLimit\\TrialModeWatermark\\TrialModeWatermark"));

            // Disabled recent trick display. Doesn't look very good and seems not very useful.
            //GameObjectManager.pInstance.Add(GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\RecentTrickDisplay\\RecentTrickDisplay"));

            GameObjectManager.pInstance.Add(GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\ScoreLabel\\ScoreLabel"));
            GameObjectManager.pInstance.Add(GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\HitCountDisplay\\HitCountDisplay"));
            GameObjectManager.pInstance.Add(GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\HiScoreLabel\\HiScoreLabel"));
            GameObjectManager.pInstance.Add(GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\HitCountDisplayRecord\\HitCountDisplayRecord"));

            // The tiled background image that travels will the player creating the illusion of
            // an infinite background image.
            GameObject bg = new GameObject();
            MBHEngine.Behaviour.Behaviour t = new InfiniteBG(bg, null);
            bg.AttachBehaviour(t);
            bg.pRenderPriority = 20;
            GameObjectManager.pInstance.Add(bg);
            
            // Create the level.
            WorldManager.pInstance.Initialize();

            // Debug display for different states in the game.  This by creating new behaviours, additional
            // stats can be displayed.
            GameObject debugStatsDisplay = new GameObject();
            MBHEngine.Behaviour.Behaviour fps = new MBHEngine.Behaviour.FrameRateDisplay(debugStatsDisplay, null);
            debugStatsDisplay.AttachBehaviour(fps);
            GameObjectManager.pInstance.Add(debugStatsDisplay);

            // The player himself.
            GameObject player = new GameObject("GameObjects\\Characters\\Player\\Player");
            GameObjectManager.pInstance.Add(player);

            // Store the player for easy access.
            GameObjectManager.pInstance.pPlayer = player;

            GroundShadow.SetTargetMessage setTarg = new GroundShadow.SetTargetMessage();

            GameObject shadow = new GameObject("GameObjects\\Items\\PlayerShadow\\PlayerShadow");
            GameObjectManager.pInstance.Add(shadow);
            setTarg.mTarget_In = player;
            shadow.OnMessage(setTarg);

            GameObject ball = new GameObject("GameObjects\\Items\\Ball\\Ball");
            GameObjectManager.pInstance.Add(ball);
            shadow = new GameObject("GameObjects\\Items\\BallShadow\\BallShadow");
            GameObjectManager.pInstance.Add(shadow);
            setTarg.mTarget_In = ball;
            shadow.OnMessage(setTarg);

            GameObject partner = new GameObject("GameObjects\\Characters\\Partner\\Partner");
            GameObjectManager.pInstance.Add(partner); 
            shadow = new GameObject("GameObjects\\Items\\PlayerShadow\\PlayerShadow");
            GameObjectManager.pInstance.Add(shadow);
            setTarg.mTarget_In = partner;
            shadow.OnMessage(setTarg);

            GameObject opponent = new GameObject("GameObjects\\Characters\\Opponent\\Opponent");
            GameObjectManager.pInstance.Add(opponent);
            shadow = new GameObject("GameObjects\\Items\\PlayerShadow\\PlayerShadow");
            GameObjectManager.pInstance.Add(shadow);
            setTarg.mTarget_In = opponent;
            shadow.OnMessage(setTarg);

            opponent = new GameObject("GameObjects\\Characters\\Opponent\\Opponent");
            opponent.pPosX = 75.0f;
            GameObjectManager.pInstance.Add(opponent);
            shadow = new GameObject("GameObjects\\Items\\PlayerShadow\\PlayerShadow");
            GameObjectManager.pInstance.Add(shadow);
            setTarg.mTarget_In = opponent;
            shadow.OnMessage(setTarg);

            // The vingette effect used to dim out the edges of the screen.
            //GameObject ving = new GameObject("GameObjects\\Interface\\Vingette\\Vingette");
#if SMALL_WINDOW
            //ving.pScale = new Vector2(0.5f, 0.5f);
#endif
            //GameObjectManager.pInstance.Add(ving);

            DebugMessageDisplay.pInstance.AddConstantMessage("Game Load Complete.");
        }