예제 #1
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here


            //scenes

            startMenu = new MerlinsQuest.Start(this, spriteBatch);
            story     = new Story(this, spriteBatch);
            fight     = new MerlinsQuest.Screens.Fight.Fight(this, spriteBatch);
            victory   = new VictoryScreen(this, spriteBatch);


            about     = new About(this, spriteBatch);
            howToPlay = new HowToPlay(this, spriteBatch);
            help      = new Help(this, spriteBatch);


            this.Components.Add(startMenu);
            this.Components.Add(story);
            this.Components.Add(fight);
            this.Components.Add(victory);
            this.Components.Add(about);
            this.Components.Add(howToPlay);
            this.Components.Add(help);

            this.song = Content.Load <Song>("Sound/merlinSong");

            this.menuSong = Content.Load <Song>("Sound/menuSong");

            MediaPlayer.Play(menuSong);
            MediaPlayer.IsRepeating = true;

            MediaPlayer.Volume = 0.5f;

            startMenu.show();
            story.hide();
            fight.hide();
            victory.hide();
            about.hide();
            howToPlay.hide();
            help.hide();
        }
예제 #2
0
        protected override void Update(GameTime gameTime)
        {
            KeyboardState current_ks = Keyboard.GetState();


            int selectedIndex = 0;

            if (startMenu.Enabled)
            {
                selectedIndex = startMenu.Menu.SelectedIndex;
                if (selectedIndex == 0 && current_ks.IsKeyDown(Keys.Enter) && previous_ks.IsKeyUp(Keys.Enter))
                {
                    startMenu.hide();
                    story.show();
                }
                if (selectedIndex == 1 && current_ks.IsKeyDown(Keys.Enter) && previous_ks.IsKeyUp(Keys.Enter))
                {
                    startMenu.hide();
                    howToPlay.show();
                }
                if (selectedIndex == 2 && current_ks.IsKeyDown(Keys.Enter) && previous_ks.IsKeyUp(Keys.Enter))
                {
                    startMenu.hide();
                    help.show();
                }
                if (selectedIndex == 3 && current_ks.IsKeyDown(Keys.Enter) && previous_ks.IsKeyUp(Keys.Enter))
                {
                    startMenu.hide();
                    about.show();
                }
                if (selectedIndex == 4 && current_ks.IsKeyDown(Keys.Enter) && previous_ks.IsKeyUp(Keys.Enter))
                {
                    Exit();
                }
                previous_ks = current_ks;
            }
            if (story.Enabled && story.StoryComp.storyOver == true)
            {
                story.hide();
                fight.show();
            }
            if (fight.Enabled && fight.gameWon == true)
            {
                fight.hide();
                victory.show();
            }


            if (howToPlay.Enabled && howToPlay.navMenu == true)
            {
                howToPlay.hide();

                startMenu = new Start(this, spriteBatch);
                this.Components.Add(startMenu);
                startMenu.show();
            }

            if (help.Enabled && help.navMenu == true)
            {
                help.hide();

                startMenu = new Start(this, spriteBatch);
                this.Components.Add(startMenu);
                startMenu.show();
            }

            if (about.Enabled && about.navMenu == true)
            {
                about.hide();

                startMenu = new Start(this, spriteBatch);
                this.Components.Add(startMenu);
                startMenu.show();
            }

            if (victory.Enabled && victory.VicComp.navMain == true)
            {
                this.Components.Remove(fight);
                this.Components.Remove(victory);
                hideAllScenes();
                fight = new Screens.Fight.Fight(this, spriteBatch);
                this.Components.Add(fight);
                fight.hide();
                fight.RESTART_GAME = false;

                victory = new VictoryScreen(this, spriteBatch);
                this.Components.Add(victory);
                victory.hide();

                startMenu = new Start(this, spriteBatch);
                this.Components.Add(startMenu);
                startMenu.show();
            }



            if (fight.RESTART_GAME == true)
            {
                this.Components.Remove(fight);

                hideAllScenes();

                fight = new Screens.Fight.Fight(this, spriteBatch);
                this.Components.Add(fight);
                fight.show();
                fight.RESTART_GAME = false;
            }

            if (fight.navMenu == true)
            {
                this.Components.Remove(fight);

                hideAllScenes();

                fight = new Screens.Fight.Fight(this, spriteBatch);
                this.Components.Add(fight);
                fight.hide();
                fight.navMenu = false;

                startMenu = new Start(this, spriteBatch);
                this.Components.Add(startMenu);
                startMenu.show();
            }

            // TODO: Add your update logic here

            base.Update(gameTime);
        }