コード例 #1
0
        public override void Action(GameStateArgs gmStateArgs)
        {
            string input;

            //Check if WaitingtoStart state was invoked with input string argument
            if (gmStateArgs != null)
            {
                input = gmStateArgs.StringData;
            }
            else
            {
                input = Console.ReadLine();
            }

            if (input != null && _startGameCommandRegEx.IsMatch(input))
            {
                GameStateArgs gStateArgs = new GameStateArgs();
                gStateArgs.StringData = input;

                InvokingFSM.PerformTransitionTo(GameStateID.Playing, gStateArgs);
            }
            else
            {
                InvokingFSM.PerformTransitionTo(GameStateID.EndSession, null);
            }
        }
コード例 #2
0
        void RestartGame(GameStateArgs argsForWaitingToStartState)
        {
            _endGame = true;

            if (argsForWaitingToStartState == null)
            {
                InvokingFSM.PerformTransitionTo(GameStateID.WaitingToStart);
            }
            else
            {
                InvokingFSM.PerformTransitionTo(GameStateID.WaitingToStart, argsForWaitingToStartState);
            }

            if (_turn > 0)
            {
                //If there were turns, we'll display infromation about last game
                Console.WriteLine("Turn: {0}, cards: {1}", _turn, _currentTable.Values.Sum((x) => x.Count));
            }
        }
コード例 #3
0
 public override void Action(GameStateArgs gmStateArgs)
 {
     InvokingFSM.Stop();
 }
コード例 #4
0
 void StopGameSession()
 {
     _endGame = true;
     InvokingFSM.PerformTransitionTo(GameStateID.EndSession);
 }