Exemple #1
0
        /// <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);

            // TODO: Add your drawing code here

            switch (mCurrentScreen)
            {
            case ScreenState.StartMenu:
            {
                break;
            }

            case ScreenState.Purchase:
            {
                PurchaseCombatUnit.showListOfCombatUnitsForPurchase(spriteBatch, player, this.Content, mapController);
                break;
            }

            case ScreenState.Map:
            {
                mapController.Draw(spriteBatch, this.Content, ref player);         // draws the map
                break;
            }

            case ScreenState.MoveUnits:
            {
                mapController.drawUnitSelectionScreen(this, this.Content, spriteBatch, player, previousMouseState);         // draws select units screan.
                break;
            }

            case ScreenState.Battleboard:
            {
                // no drawing
                break;
            }

            case ScreenState.SelectCasualties:
            {
                CombatControl.drawSelectedCasualties(this.Content, ref mapController, spriteBatch, player);
                break;
            }

            case ScreenState.Victory:
            {
                Victory.drawVictory(this, ref player, spriteBatch, this.Content);
                break;
            }
            }
            base.Draw(gameTime);
        }
Exemple #2
0
        /// <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)
        {
            // TODO: Add your update logic here

            #region Exit methods
            KeyboardState keyboardState = Keyboard.GetState();
            // Allows the game to exit with escape`
            if (keyboardState.IsKeyDown(Keys.Escape) && previousKeyboardState.IsKeyUp(Keys.Escape))
            {
                this.Exit();
            }

            #endregion

            switch (mCurrentScreen)
            {
            case ScreenState.StartMenu:
            {
                break;
            }

            case ScreenState.Purchase:
            {
                PurchaseCombatUnit.selectListOfCombatUnitsForPurchase(this, previousKeyboardState, mapController, player, previousMouseState);
                break;
            }

            case ScreenState.Map:
            {
                mapController.moveMap(this, ref player, previousKeyboardState);                                 // moves the map around using the arrow keys.
                mapController.selectTerritory(this.Content, spriteBatch, this, previousMouseState, ref player); // check it user clicks on territory.
                break;
            }

            case ScreenState.MoveUnits:
            {
                mapController.unitSelectionScreen(this, previousKeyboardState, ref player, previousMouseState);
                break;
            }

            case ScreenState.Battleboard:
            {
                CombatControl.searchForCombat(ref mapController, this);
                break;
            }

            case ScreenState.SelectCasualties:
            {
                CombatControl.selectCasualties(this.Content, spriteBatch, this, previousMouseState, ref mapController, player);
                break;
            }

            case ScreenState.Victory:
            {
                break;
            }
            }

            previousMouseState    = Mouse.GetState();
            previousKeyboardState = Keyboard.GetState();

            base.Update(gameTime);
        }