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); } }
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)); } }
public override void Action(GameStateArgs gmStateArgs) { InvokingFSM.Stop(); }
void StopGameSession() { _endGame = true; InvokingFSM.PerformTransitionTo(GameStateID.EndSession); }