Exemplo n.º 1
0
        public void Init()
        {
            Engine    = new GameEngine();
            menuInput = new UserInputController();
            gameInput = new UserInputController();

            fsa.AddLink(States.Menu, States.Game, "new", OnNewGame);
            fsa.AddLink(States.Init, States.Menu, "init_complete", OnExitToMenu);

            var exitCommand = new UserCommand("exit", "Immediately closes the application",
                                              "OnExit", this, null);

            menuInput.AddCommand(exitCommand);
            gameInput.AddCommand(exitCommand);

            menuInput.AddCommand(new UserCommand("new", "Starts new game",
                                                 () => fsa.Switch("new")));

            gameInput.AddCommand(new UserCommand("list", "Shows this list",
                                                 OnPrintListOfCommands));
            gameInput.AddCommand(new UserCommand("look", "Look at location for more details",
                                                 "OnOverview", Engine, new ArgumentSet(typeof(string))));
            gameInput.AddCommand(new UserCommand("turn", "Next turn",
                                                 "OnTurn", Engine, null));

            fsa.Switch("init_complete");
        }
Exemplo n.º 2
0
 void OnExitToMenu(States oldState, States newState)
 {
     currentInput = menuInput;
     OnPrintListOfCommands();
 }
Exemplo n.º 3
0
 void OnNewGame(States oldState, States newState)
 {
     currentInput = gameInput;
     Engine.CreateNewGame();
     Console.WriteLine("Welcome to the GameOfHomes! Type 'list' for a list of commands");
 }