示例#1
0
        private Checkers_LogicAndDataSection.InitialGameSetting setup()
        {
            Checkers_LogicAndDataSection.InitialGameSetting res = new Checkers_LogicAndDataSection.InitialGameSetting();

            res.player1Name = "amir";
            res.player2Name = "ori";
            res.gameType    = Checkers_LogicAndDataSection.eTypeOfGame.doublePlayer;
            res.boardSize   = Checkers_LogicAndDataSection.eBoardSizeOptions.MediumBoard;

            return(res);
        }
示例#2
0
        public static void InitializePlayers(InitialGameSetting i_NameSettings)
        {
            s_Player1.InitializePlayer(i_NameSettings.GetPlayerName(ePlayerOptions.Player1), Checkers_LogicAndDataSection.ePlayerOptions.Player1);
            switch (Checkers_LogicAndDataSection.SessionData.s_GameType)
            {
            case Checkers_LogicAndDataSection.eTypeOfGame.singlePlayer:
                s_Player2.InitializePlayer("PC", Checkers_LogicAndDataSection.ePlayerOptions.ComputerPlayer);
                m_TheOtherPlayer = ePlayerOptions.ComputerPlayer;

                break;

            case Checkers_LogicAndDataSection.eTypeOfGame.doublePlayer:
                s_Player2.InitializePlayer(i_NameSettings.GetPlayerName(ePlayerOptions.Player2), Checkers_LogicAndDataSection.ePlayerOptions.Player2);
                m_TheOtherPlayer = ePlayerOptions.Player2;
                break;
            }
        }
示例#3
0
        public void RunCheckersGame()
        {
            m_IsGameOn = true;
            Checkers_LogicAndDataSection.InitialGameSetting GameDemoSettings = setup();//Checkers_UI.class.setup
            Checkers_LogicAndDataSection.SessionData.initializeSessionData(GameDemoSettings);

            InitializePlayers(GameDemoSettings);
            InitializeGameBoard();

            while (m_IsGameOn)
            {
                m_currentActivePlayer = GetNextPlayer();

                while (!m_isRequestedMoveLegal)
                {
                    m_RequestedMove = UI.ReadAndCheckInput();
                    if (Checkers_LogicAndDataSection.GameBoard.CheckIfMoveIsOk(m_RequestedMove))
                    {
                        m_isRequestedMoveLegal = true;
                    }
                }
                m_currentActivePlayer.MakeAMove(m_RequestedMove, m_CheckersBoard); //at the end of this method - we are ready to get the next move in the game
            }
        }
示例#4
0
 public static void initializeSessionData(InitialGameSetting gameSettings)
 {
     m_BoardSize = gameSettings.boardSize;
     gameType    = gameSettings.gameType;
 }
示例#5
0
 public static void initializeSessionData(InitialGameSetting gameSettings)
 {
     m_BoardSize = gameSettings.GetBoardSize();
     s_GameType  = gameSettings.GetGameType();
 }