Пример #1
0
    //To remove a listener for Trackers
    public static void StopListeningTracker(VRPNManager.Tracker_Types deviceType, VRPNDeviceConfig.Device_Names deviceName, UnityAction <string, VRPNTracker.TrackerReport> listener)
    {
        if (eventManager == null)
        {
            Debug.LogError("There needs to be one active EventManger script on a GameObject in your scene.");
            return;
        }
        VRPNTrackerEvent thisEvent = null;

        if (instance.eventDictionaryTracker.TryGetValue(deviceType.ToString() + " " + deviceName.ToString(), out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Пример #2
0
    //To add a listener for Buttons
    public static void StartListeningButton(VRPNManager.Button_Types deviceType, VRPNDeviceConfig.Device_Names deviceName, UnityAction <string, VRPNButton.ButtonReport> listener)
    {
        if (eventManager == null)
        {
            Debug.LogError("There needs to be one active EventManger script on a GameObject in your scene.");
            return;
        }
        VRPNButtonEvent thisEvent = null;

        if (instance.eventDictionaryButton.TryGetValue(deviceType.ToString() + " " + deviceName.ToString(), out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new VRPNButtonEvent();
            thisEvent.AddListener(listener);
            instance.eventDictionaryButton.Add(deviceType.ToString() + " " + deviceName.ToString(), thisEvent);
        }
    }