public HapticDeviceInfo(HapticSystemAttribute sysAttribute, Type devType)
        {
            systemAttribute = sysAttribute;
            deviceType      = devType;

            isSelected = false;
        }
Exemplo n.º 2
0
        public override void ApplyDefaultData(HapticSystemAttribute hapticSystemInfo)
        {
            base.ApplyDefaultData(hapticSystemInfo);

            indexFingerCoordinates  = Resources.Load <ScriptableBodyCoordinate>(hapticSystemInfo.AdditionalData[0] as string);
            middleFingerCoordinates = Resources.Load <ScriptableBodyCoordinate>(hapticSystemInfo.AdditionalData[1] as string);
            ringFingerCoordinates   = Resources.Load <ScriptableBodyCoordinate>(hapticSystemInfo.AdditionalData[2] as string);
            pinkyFingerCoordinates  = Resources.Load <ScriptableBodyCoordinate>(hapticSystemInfo.AdditionalData[3] as string);

            isRightHand = (bool)hapticSystemInfo.AdditionalData[4];
        }
        public virtual void ApplyDefaultData(HapticSystemAttribute hapticSystemAtt)
        {
            // Check to see if the first data point is a BodyCoordinateSystem
            ScriptableBodyCoordinate bodyCoordinate = Resources.Load <ScriptableBodyCoordinate>(hapticSystemAtt.AffectedBodyFileLocation);

            if (bodyCoordinate != null)
            {
                affectedBodyPart = bodyCoordinate;
            }

            hapticSystemInfo = hapticSystemAtt;
        }
        protected void Awake()
        {
            targetManager = target as HapticManager;

            hapticSystemAndDevices = new Dictionary <string, List <HapticDeviceInfo> >();
            hapticSystemEditorInfo = new Dictionary <string, HapticSystemEditorInfo>();

            // Get all the haptic device classes in the project
            foreach (Type type in Assembly.GetAssembly(typeof(HapticDevice)).GetTypes())
            {
                object[] attributeList = type.GetCustomAttributes(typeof(HapticSystemAttribute), true);

                if (attributeList.Length > 0)
                {
                    foreach (object currentAttribute in attributeList)
                    {
                        HapticSystemAttribute hapticAttribute = currentAttribute as HapticSystemAttribute;

                        if (!hapticSystemAndDevices.ContainsKey(hapticAttribute.SystemName))
                        {
                            hapticSystemAndDevices.Add(hapticAttribute.SystemName, new List <HapticDeviceInfo>()
                            {
                                new HapticDeviceInfo(hapticAttribute, type)
                            });

                            hapticSystemEditorInfo.Add(hapticAttribute.SystemName, new HapticSystemEditorInfo());
                        }
                        else
                        {
                            hapticSystemAndDevices[hapticAttribute.SystemName].Add(new HapticDeviceInfo(hapticAttribute, type));
                        }
                    }
                }
            }

            // Use EditorPrefs to find the devices that are being used by the developer
            foreach (KeyValuePair <string, List <HapticDeviceInfo> > currentDevice in hapticSystemAndDevices)
            {
                for (int n = 0; n < currentDevice.Value.Count; n++)
                {
                    currentDevice.Value[n].isSelected = EditorPrefs.GetBool(Constants.EditorPrefLocation + currentDevice.Key + "." + currentDevice.Value[n].systemAttribute.DeviceName);
                }
            }

            useVisualizer = EditorPrefs.GetBool(Constants.EditorPrefLocation + "UseVisualizer");
        }
        public override void ApplyDefaultData(HapticSystemAttribute hapticSystemInfo)
        {
            base.ApplyDefaultData(hapticSystemInfo);

#if VRTK_DEFINE_SDK_BHAPTICS
            devicePosition = (Pos)Enum.Parse(typeof(Pos), hapticSystemInfo.AdditionalData[0].ToString());
#endif

            if (hapticSystemInfo.AdditionalData.Length > 1)
            {
                ScriptableDeviceMapping mapping = Resources.Load <ScriptableDeviceMapping>(hapticSystemInfo.AdditionalData[1] as string);

                if (mapping != null)
                {
                    bhapticsMapping = mapping;
                }
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// This override is used to determine the correct XRNode type for this device.
 /// </summary>
 public override void ApplyDefaultData(HapticSystemAttribute hapticSystemInfo)
 {
     base.ApplyDefaultData(hapticSystemInfo);
     // the first entry in additional data is true if this is the right hand and false otherwise
     handNodeType = (bool)hapticSystemInfo.AdditionalData[0] ? XRNode.RightHand : XRNode.LeftHand;
 }
Exemplo n.º 7
0
        /// <summary>
        /// This override is used to determine the correct XRNode type for this device.
        /// </summary>
        public override void ApplyDefaultData(HapticSystemAttribute hapticSystemInfo)
        {
            base.ApplyDefaultData(hapticSystemInfo);

            // no op - base class abstract but operation not supported in this version of Unity
        }
Exemplo n.º 8
0
        public override void ApplyDefaultData(HapticSystemAttribute hapticSystemInfo)
        {
            base.ApplyDefaultData(hapticSystemInfo);

            isRightGlove = (bool)hapticSystemInfo.AdditionalData[0];
        }
Exemplo n.º 9
0
        public override void ApplyDefaultData(HapticSystemAttribute hapticSystemInfo)
        {
            base.ApplyDefaultData(hapticSystemInfo);

            isLeftController = !(bool)hapticSystemInfo.AdditionalData[0];
        }