コード例 #1
0
ファイル: PhaseManager.cs プロジェクト: ZEP-Arter/KNT
        private PhaseManager()
        {
            phases = new List<Phase>(6);

            initGamePhases();

            currentPhase = phases[0];
        }
コード例 #2
0
ファイル: PhaseManager.cs プロジェクト: ZEP-Arter/KNT
        private Phase getNextPhase()
        {
            if (phases.IndexOf(currentPhase) != phases.Capacity - 1)
                currentPhase = phases[phases.IndexOf(currentPhase) + 1];
            else
                currentPhase = phases[1];

            return currentPhase;
        }
コード例 #3
0
ファイル: KNT_Game.cs プロジェクト: ZEP-Arter/KNT
        /// <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);
        }
コード例 #4
0
ファイル: KNT_Game.cs プロジェクト: ZEP-Arter/KNT
 /// <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();
 }