/// <summary> /// Support function, usually called from <see cref="CheckIfUnityObjectExists"/>. First it creates a new <see cref="GenericDeviceData"/> according to the <see cref="GenericDevice"/> received as a parameter. Then, it instantiate a Unity object for each new detection for devices of this type. /// </summary> /// <param name="genericDevice">The device being checked.</param> protected virtual void CreateNewUnityObject(GenericDevice genericDevice) { foreach (var values in genericDevice.GetNewDetections(DevicesData.Keys.ToList())) { var genericDeviceData = CreateGenericDeviceData(genericDevice.DeviceName, values); AddDeviceDataToList(values.Id, genericDeviceData); InstantiateUnityObject(genericDeviceData); } }
/// <summary> /// First it creates a new <see cref="LeapMotionData"/> according to the <see cref="Neurorehab.Scripts.CpDebugger.Udp.GenericDevice"/> received as a parameter. Then, it instantiates a Unity object according to the hand side for each new detection for devices of this type. /// </summary> /// <param name="genericDevice">The device being checked.</param> protected override void CreateNewUnityObject(GenericDevice genericDevice) { foreach (var values in genericDevice.GetNewDetections(DevicesData.Keys.ToList())) { var genericDeviceData = (LeapMotionData)CreateGenericDeviceData(genericDevice.DeviceName, values); InstantiateUnityObject(genericDeviceData, genericDeviceData.LeftHanded ? 0 : 1); AddDeviceDataToList(values.Id, genericDeviceData); } }