Ejemplo n.º 1
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)
        {
            // Allows the game to exit
            KeyboardState state = Keyboard.GetState();
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || state.IsKeyDown(Keys.Escape))
                this.Exit();

            UpdateButtons();

            switch(_theGameBoard.getCurrentPhase().getName())
            {
                case "Setup":
                    currentPhase.playPhase(_theGameBoard.getPlayers());
                    me = currentPhase.getCurrentPlayer();
                    //Console.WriteLine(me.getName());
                    break;
                case "Gold Collection":
                    currentPhase.playPhase(_theGameBoard.getPlayers());
                    me = currentPhase.getCurrentPlayer();
                    //Console.WriteLine(me.getName());
                    break;
                case "Recruit Things":
                    currentPhase.playPhase(_theGameBoard.getPlayers());
                        if( me.getInPhase() )
                            ((RecruitThingsPhase)currentPhase).recruitThings();
                    me = currentPhase.getCurrentPlayer();
                    //Console.WriteLine(me.getName());
                    break;
                case "Movement":
                    currentPhase.playPhase(_theGameBoard.getPlayers());
                    me = currentPhase.getCurrentPlayer();
                    //Console.WriteLine(me.getName());
                    break;
                case "Combat":
                    currentPhase.playPhase(_theGameBoard.getPlayers());
                    me = currentPhase.getCurrentPlayer();
                    break;
                case "Construction":
                    currentPhase.playPhase(_theGameBoard.getPlayers());
                    me = currentPhase.getCurrentPlayer();
                    break;
            }

            if (currentPhase.getCurrentState() == Phase.State.END)
                currentPhase = _theGameBoard.play();

            base.Update(gameTime);
        }