예제 #1
0
        // Edited by Noble 12-10
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || UtilityClass.SingleActivationKey(Keys.End))
            {
                this.Exit();
            }

            UtilityClass.Update();

            switch (GameState)
            {
            case GameStates.MainMenu:
                MainMenu.Update();
                break;

            case GameStates.InGame:
                InGame.Update(gameTime);
                break;

            case GameStates.Tutorial:
                Tutorial.Update(gameTime);
                break;

            case GameStates.Credits:
                Credits.Update(gameTime);
                break;

            case GameStates.Exit:
                this.Exit();
                break;

            case GameStates.HighScore:
                break;

            case GameStates.GameOver:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (UtilityClass.SingleActivationKey(Keys.Escape))
            {
                LoadContent();
            }

            base.Update(gameTime);
        }
예제 #2
0
        // Edited by Noble 12-10
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            switch (GameState)
            {
            case GameStates.MainMenu:
                MainMenu.Draw(spriteBatch);
                break;

            case GameStates.InGame:
                InGame.Draw(spriteBatch, GraphicsDevice);
                break;

            case GameStates.HighScore:
                HighScore.Draw(spriteBatch);
                break;

            case GameStates.Tutorial:
                Tutorial.Draw(spriteBatch, GraphicsDevice);
                break;

            case GameStates.Credits:
                Credits.Draw(spriteBatch, GraphicsDevice);
                break;

            case GameStates.GameOver:
                GameOver.Draw(spriteBatch);
                break;

            case GameStates.Exit:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // Run final actions
            if (!finalActionsDelegate.Equals(new FinalActionsDelegate(() => { })))
            {
                // Run delegate
                finalActionsDelegate();
                // Clear delegate
                finalActionsDelegate = () => { };
            }
            base.Draw(gameTime);
        }
예제 #3
0
        /// <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.
            spriteBatch = new SpriteBatch(GraphicsDevice);


            NormalMenuFont = Content.Load <SpriteFont>(@"Fonts/NormalMenuFont");
            BoldMenuFont   = Content.Load <SpriteFont>(@"Fonts/BoldMenuFont");

            CreditsFont      = Content.Load <SpriteFont>(@"Fonts/CreditsFont");
            BoldCreditsFont  = Content.Load <SpriteFont>(@"Fonts/BoldCreditsFont");
            CreditsTitleFont = Content.Load <SpriteFont>(@"Fonts/CreditsTitleFont");

            MainMenu.LoadContent(Content);
            InGame.LoadContent(Content, GraphicsDevice);
            Tutorial.LoadContent(Content, GraphicsDevice);
            HighScore.LoadContent(Content);
            Credits.LoadContent(Content, GraphicsDevice);
            GameOver.LoadContent(Content);

            GameState = GameStates.MainMenu;
        }