コード例 #1
0
        /// <summary>
        /// Called by substates to indicate they're ready. This state then
        /// Gets the necessary information from them.
        /// </summary>
        /// <param name="state"></param>
        public override void OnStateComplete(string completedState)
        {
            switch (completedState)
            {
            case ("Settings"):
                soundSelect.Play();                                    // Play the menu sound effect

                boxingManager.NumRounds = settingsManager.GetRounds(); // Get the number of rounds

                state = brawlgamestate.playerselect;                   // Move to the player select state
                // initialize the player select state
                playerSelectManager = new Player_Select_Popup(this, game.Content, inputs, bounds, game.GraphicsDevice);

                // We don't need the settings manager anymore, so de-reference it.
                settingsManager.Destruct();
                settingsManager = null;


                break;

            case ("PlayerSelect"):
                soundSelect.Play();     // Play sounds

                // Get the colors
                colors = playerSelectManager.GetPlayerColors;

                state          = brawlgamestate.loadout;
                loadoutManager = new LoadOut_Manager(this, bounds, inputs, items);
                loadoutManager.LoadContent(game.Content);
                loadoutManager.Activate(game.Content);

                playerSelectManager.Destruct();
                playerSelectManager = null;

                Debug.WriteLine("Entered Loadout state");

                break;

            case ("LoadOut"):
                soundSelect.Play();           // Play sounds

                state = brawlgamestate.brawl; // change the state

                // Set up the boxer's with their colors and equipment
                boxingManager.ApplySettings(colors, loadoutManager.equipment);
                boxingManager.Reset();

                // Unhook any event listenters and dereference the loadoutManager
                loadoutManager.Destruct();
                loadoutManager = null;

                Debug.WriteLine("Entered Boxing state");

                break;

            case ("Boxing"):
                break;
            }
        }
コード例 #2
0
        List <Item>[] items; // an array of item lists containing all items, for use  in the loadout.

        #endregion



        public Brawl_Game_State(Game game, Input_Handler[] inputs, Rectangle bounds)
            : base(game, inputs, bounds)
        {
            // Load some assets
            font = game.Content.Load <SpriteFont>("Menu/menufont");
            SoundEffect menuSound = game.Content.Load <SoundEffect>("Sounds/MenuC");

            soundSelect = game.Content.Load <SoundEffect>("Sounds/MenuE");

            // Set initial state
            state           = brawlgamestate.settings; // Start by settings the number of rounds
            settingsManager = new Settings_Popup(this, game.Content, inputs, bounds);

            // Use the boxing managers background for all the others:
            boxingManager = new Boxing_Manager(game.Content, bounds, inputs, game.GraphicsDevice, game.camera);

            // Initialize each players library of items
            items = new List <Item> [4];
            for (int i = 0; i < 4; i++)
            {
                items[i] = new List <Item>();
                // Each player gets access to the full library
                items[i].Add(new Cane(game.Content.Load <Texture2D>("LoadOut/cane_icon")));
                items[i].Add(new Revolver(game.Content.Load <Texture2D>("LoadOut/revolver_icon")));
                items[i].Add(new Bowler_Hat(game.Content.Load <Texture2D>("LoadOut/bowlerhat_icon")));
                items[i].Add(new Cape(game.Content.Load <Texture2D>("LoadOut/cape_icon")));
            }



            // old stuff:

            // consruct the settings popup.
            //settings// = new Settings_Popup(game.Content, inputs, bounds);
            //settings//.menu.OnEntrySelect += HandleMenuSelect;

            // Construct the player_select_popup
            //playerSelect = new Player_Select_Popup(game.Content, inputs, bounds, game.GraphicsDevice);

            // Construct the Loadout manager.

            // construct the boxing manager for the background
            //boxingManager = new Boxing_Manager(game.Content, bounds, inputs, game.GraphicsDevice, game.camera);
        }