Beispiel #1
0
        private PhaseManager()
        {
            phases = new List<Phase>(6);

            initGamePhases();

            currentPhase = phases[0];
        }
Beispiel #2
0
        private Phase getNextPhase()
        {
            if (phases.IndexOf(currentPhase) != phases.Capacity - 1)
                currentPhase = phases[phases.IndexOf(currentPhase) + 1];
            else
                currentPhase = phases[1];

            return currentPhase;
        }
Beispiel #3
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);
        }
Beispiel #4
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     _theGameBoard = GameBoard.Game;
     me = _theGameBoard.getPlayers()[0];
     currentPhase = _theGameBoard.play();
     //testPlay();
     this.IsMouseVisible = true;
     base.Initialize();
 }