Ejemplo n.º 1
0
        //PerformTurn: Goes through each human player (ActivePlayer) and prompts them for their turn. Then moves through CPU players and performs their turn.

        //TODO:
        //Que CPU turn, implement CPU list. Think of more ways to play.
        //Populate switch menu. Player options are split between the driving method PerformTurn(this) and the presentation layer of PlayerTurnPrompt.

        public static int PerformTurn(GameSentinel activeGame)
        {
            foreach (Player ActivePlayer in activeGame.PlayerList)
            {
                int PlayerChoice = activeGame.PlayerTurnPrompt();

                //Verify only living players are taking turns!
                if (!ActivePlayer.IsPlayerDead())
                {
                    switch (PlayerChoice)
                    {
                    case 0:
                        return(0);

                    case 1:
                        foreach (AssembledShip PlayerShip in ActivePlayer.PlayerShips)
                        {
                            activeGame.PlayerMoveShip(PlayerShip);
                            return(1);
                        }
                        break;
                    }
                }
            }

            //Catch-all exit.
            Console.WriteLine("Something Went wrong in GameSentinel. Exiting.");
            return(0);

            // Next we roll through CPU turns.
            //TODO: Complete CPU turns once you have finished writing CPU selection / Object

            //foreach (CPU ActiveCPU in activeGame.CPUlist)
            //{


            //    //Verify only living CPU's are taking turns!
            //    if (!ActiveCPU.IsCPUDead())
            //    {


            //    }

            //}



            Console.WriteLine("End of turn!");
        }