Пример #1
0
        /* This method should be called when the level is loaded to set up currently-connected game controllers,
         * and register for the relevant notifications to deal with new connections/disconnections. */
        public void ConfigureGameControllers()
        {
            // Receive notifications when a controller connects or disconnects.
            didConnectObserver    = GCController.Notifications.ObserveDidConnect(GameControllerDidConnect);
            didDisconnectObserver = GCController.Notifications.ObserveDidDisconnect(GameControllerDidDisconnect);

            // Configure all the currently connected game controllers.
            ConfigureConnectedGameControllers();

            // And start looking for any wireless controllers.
            GCController.StartWirelessControllerDiscovery(() => Console.WriteLine("Finished finding controllers"));
        }
        private void FindController()
        {
            lock (_lockObject)
            {
                _didConnectNotification = GCController.Notifications.ObserveDidConnect((sender, args) =>
                {
                    FoundController();
                });

                GCController.StartWirelessControllerDiscovery(() => { });
            }
        }