Beispiel #1
0
        private void StartComponents(GameConfiguration configuration)
        {
            // Instantiate components
            _server = new GameTcpServer();
            _game = new GameController(_server, configuration);

            // Add listeners
            _server.Subscribe(_game);

            // Start the TCP Service
            _server.StartService();

            // Create and start the DiscoveryService
            var discovery = new DiscoveryService();
            discovery.Start();

            // Start the game
            var worker = new BackgroundWorker();
            worker.DoWork += (sender, args) => _game.Loop();
            worker.RunWorkerAsync();
        }