public bool addDevice(string deviceName, VRPNDeviceType type) { Debug.Log(deviceName); VRPNDevice device = new VRPNDevice(deviceName, type); if (true || (availableDevices.Contains(deviceName) && !devices.ContainsKey(deviceName))) { devices.Add(deviceName, device); switch (type) { case VRPNDeviceType.Phantom: Debug.Log("Instanciating VRPNPicker"); GameObject go = (GameObject)GameObject.Instantiate(Resources.Load("VRPN/VRPNPicker", typeof(GameObject)), Vector3.zero, Quaternion.identity); Debug.Log("Configuring VRPNPickerController"); VRPNPickerController s1 = go.GetComponent <VRPNPickerController>(); if (s1) { s1.setManager(this); s1.setDeviceName(deviceName); } Debug.Log("After pickercontroller"); VRPNButtonController s2 = go.GetComponent <VRPNButtonController>(); if (s2) { s2.setManager(this); s2.setDeviceName(deviceName); } VRPNForceFeedback s3 = go.GetComponent <VRPNForceFeedback>(); if (s3) { s3.setManager(this); s3.setDeviceName(deviceName); if (!s3.startDeviceInLib()) { Debug.Log(":: VRPNManager :: Can't activate Force Feedback"); } } break; case VRPNDeviceType.Mouse3DConnexion: VRPNAnalogController s = GameObject.FindGameObjectWithTag("LoadBox").GetComponent <VRPNAnalogController>(); s.setManager(this); break; default: break; } return(true); } return(false); }
public VRPNDevice(string name, VRPNDeviceType type) { this.name = name; this.type = type; }