コード例 #1
0
        public override void Play(float intensity, float duration, float vestRotationAngleX, float vestRotationOffsetY, string identifier = "")
        {
            if (!BhapticsManager.Init)
            {
                BhapticsManager.Initialize();
            }

            var haptic = BhapticsManager.GetHaptic();

            if (haptic == null)
            {
                return;
            }

            if (!haptic.IsFeedbackRegistered(assetId))
            {
                haptic.RegisterTactFileStr(assetId, JsonValue);
            }

            _rotationOption.OffsetAngleX = vestRotationAngleX + this.TactFileAngleX;
            _rotationOption.OffsetY      = vestRotationOffsetY + this.TactFileOffsetY;

            _scaleOption.Intensity = intensity;
            _scaleOption.Duration  = duration;

            haptic.SubmitRegistered(assetId, keyId + identifier,
                                    _rotationOption, _scaleOption);
        }
コード例 #2
0
ファイル: HapticSource.cs プロジェクト: RTUITLab/RevolIT
        void Awake()
        {
            BhapticsManager.GetHaptic();

            if (Bhaptics_Setup.instance == null)
            {
                var findObjectOfType = FindObjectOfType <Bhaptics_Setup>();
                if (findObjectOfType == null)
                {
                    var go = new GameObject("[bhaptics]");
                    go.SetActive(false);
                    var setup  = go.AddComponent <Bhaptics_Setup>();
                    var config = Resources.Load <BhapticsConfig>("BhapticsConfig");
                    if (config == null)
                    {
                        BhapticsLogger.LogError("Cannot find 'BhapticsConfig' in the Resources folder.");
                    }
                    setup.Config = config;
                    go.SetActive(true);
                }
            }


            if (playOnAwake)
            {
                if (loop)
                {
                    PlayLoop();
                }
                else
                {
                    PlayHapticClip();
                }
            }
        }
コード例 #3
0
ファイル: HapticClip.cs プロジェクト: RTUITLab/RevolIT
        /// <summary>
        ///
        /// </summary>
        /// <param name="identifier">Use when stopping haptic feedback independently.</param>
        public virtual void Stop(string identifier)
        {
            var haptic = BhapticsManager.GetHaptic();

            if (haptic != null)
            {
                haptic.TurnOff(keyId + identifier);
            }
        }
コード例 #4
0
ファイル: HapticClip.cs プロジェクト: RTUITLab/RevolIT
        public virtual void Stop()
        {
            var haptic = BhapticsManager.GetHaptic();

            if (haptic != null)
            {
                haptic.TurnOff();
            }
        }
コード例 #5
0
        private static void OnUpdateDevicesChange(List <HapticDevice> devices)
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }
            androidHapticPlayer.UpdateDeviceList(devices);
        }
コード例 #6
0
        public static void Pair(string address, string position = "")
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }
            androidHapticPlayer.Pair(address, position);
        }
コード例 #7
0
        public static void UnpairAll()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }
            androidHapticPlayer.UnpairAll();
        }
コード例 #8
0
        public static void TogglePosition(string address)
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.TogglePosition(address);
        }
コード例 #9
0
        public static void ShowBluetoothSetting()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.ShowBluetoothSetting();
        }
コード例 #10
0
        public static void ToggleStreaming()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.ToggleStreaming();
        }
コード例 #11
0
        public static void Unpair(string address)
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.Unpair(address);
        }
コード例 #12
0
ファイル: HapticClip.cs プロジェクト: RTUITLab/RevolIT
        public virtual bool IsPlaying()
        {
            var haptic = BhapticsManager.GetHaptic();

            if (haptic == null)
            {
                return(false);
            }

            return(haptic.IsPlaying(keyId));
        }
コード例 #13
0
        public static void RequestPermission()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.RequestPermission();
        }
コード例 #14
0
        public static void ToggleEnableDevice(HapticDevice device)
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.EnableDevice(device.Address, !device.IsEnable);
        }
コード例 #15
0
        public static void ScanStop()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.StopScan();
        }
コード例 #16
0
        public static bool IsStreaming()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return(false);
            }

            return(androidHapticPlayer.IsStreamingEnable());
        }
コード例 #17
0
        public static void Ping(HapticDevice device)
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            androidHapticPlayer.Ping(device.Address);
        }
コード例 #18
0
        public static List <AndroidUtils.StreamHost> GetStreamingHosts()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return(new List <AndroidUtils.StreamHost>());
            }

            return(androidHapticPlayer.GetStreamingHosts());
        }
コード例 #19
0
ファイル: HapticClip.cs プロジェクト: RTUITLab/RevolIT
        /// <summary>
        ///
        /// </summary>
        /// <param name="identifier">Use when checking haptic feedback independently.</param>
        /// <returns></returns>
        public virtual bool IsPlaying(string identifier)
        {
            var haptic = BhapticsManager.GetHaptic();

            if (haptic == null)
            {
                return(false);
            }

            return(haptic.IsPlaying(keyId + identifier));
        }
コード例 #20
0
        public static void Ping(HapticDevice device)
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            Debug.LogFormat("PING  ..." + device.Address);

            androidHapticPlayer.Ping(device.Address);
        }
コード例 #21
0
        void OnApplicationFocus(bool pauseStatus)
        {
            if (pauseStatus)
            {
                var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;
                if (androidHapticPlayer == null)
                {
                    return;
                }

                androidHapticPlayer.RefreshPairingInfo();
            }
        }
コード例 #22
0
        public static void Scan()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            if (!androidHapticPlayer.IsScanning())
            {
                androidHapticPlayer.StartScan();
            }
        }
コード例 #23
0
        public static void Scan()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null || !AndroidPermissionsManager.CheckBluetoothPermissions())
            {
                return;
            }

            if (!androidHapticPlayer.IsScanning())
            {
                androidHapticPlayer.StartScan();
            }
        }
コード例 #24
0
        private static void RefreshDeviceListUi()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                return;
            }

            if (Instance != null)
            {
                Instance.InvokeRefresh();
            }
        }
コード例 #25
0
        private void RefreshDevices()
        {
            if (refreshActions.Count == 0)
            {
                return;
            }

            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                // if (Devices.Count == 0)
                // {
                //     var device = new HapticDevice()
                //     {
                //         Position = PositionType.Vest,
                //         IsConnected = true,
                //         IsPaired = true,
                //         Address = "aaaa",
                //         DeviceName = "Tactot",
                //         Candidates = new PositionType[] { PositionType.Vest },
                //     };
                //     var device2 = new HapticDevice()
                //     {
                //         Position = PositionType.ForearmL,
                //         IsConnected = false,
                //         IsPaired = false,
                //         Address = "aaaa22",
                //         DeviceName = "Tactosy",
                //         Candidates = new PositionType[] { PositionType.ForearmR, PositionType.ForearmL },
                //     };
                //     Devices.Add(device);
                //     Devices.Add(device2);
                //
                // }
                // // TODO DEBUGGING USAGE.
                // for (var i = 0; i < refreshActions.Count; i++)
                // {
                //     refreshActions[i].Invoke();
                // }
                return;
            }

            Devices = androidHapticPlayer.GetDevices();
            for (var i = 0; i < refreshActions.Count; i++)
            {
                refreshActions[i].Invoke();
            }
        }
コード例 #26
0
        public static bool CheckPermission()
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                if (pcAndoidTestMode)
                {
                    return(true);
                }

                return(false);
            }

            return(androidHapticPlayer.CheckPermission());
        }
コード例 #27
0
        public void OnChange()
        {
            try
            {
                var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;
                if (androidHapticPlayer == null)
                {
                    return;
                }

                androidHapticPlayer.CheckChange();
            }
            catch (Exception e)
            {
                BhapticsLogger.LogInfo("OnChange {0}", e.Message);
            }
        }
コード例 #28
0
        public override void Play(float intensity, float duration, float vestRotationAngleX, float vestRotationOffsetY)
        {
            if (!BhapticsManager.Init)
            {
                BhapticsManager.Initialize();
                return;
            }

            var haptic = BhapticsManager.GetHaptic();

            if (!haptic.IsFeedbackRegistered(assetId))
            {
                haptic.RegisterTactFileStr(assetId, JsonValue);
            }

            haptic.SubmitRegistered(assetId, keyId, new ScaleOption(intensity, duration));
        }
コード例 #29
0
        public override void Play(float intensity, float duration, float vestRotationAngleX, float vestRotationOffsetY)
        {
            if (!BhapticsManager.Init)
            {
                BhapticsManager.Initialize();
                return;
            }

            var haptic = BhapticsManager.GetHaptic();

            if (Mode == FeedbackType.DotMode)
            {
                haptic.Submit(keyId, ToPositionType(Position), Convert(DotPoints), TimeMillis);
            }
            else
            {
                haptic.Submit(keyId, ToPositionType(Position), Convert(Points), TimeMillis);
            }
        }
コード例 #30
0
        public static List <HapticDevice> GetDevices(bool force = false)
        {
            var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic;

            if (androidHapticPlayer == null)
            {
                var device = new HapticDevice()
                {
                    Position         = PositionType.Vest,
                    IsConnected      = false,
                    IsPaired         = true,
                    Address          = "aaaa",
                    Battery          = 100,
                    Rssi             = -100,
                    DeviceName       = "Tactot",
                    Candidates       = new PositionType[] { PositionType.Vest },
                    ConnectionStatus = "Disconnected",
                };
                var device2 = new HapticDevice()
                {
                    Position         = PositionType.ForearmL,
                    IsConnected      = false,
                    IsPaired         = false,
                    Address          = "aaaa22",
                    Battery          = 100,
                    Rssi             = -100,
                    DeviceName       = "Tactosy",
                    ConnectionStatus = "Disconnected",
                    Candidates       = new PositionType[] { PositionType.ForearmR, PositionType.ForearmL },
                };
                var list = new List <HapticDevice>();
                // list.Add(device);
                // list.Add(device2);
                // TODO DEBUGGING USAGE.
                return(list);
            }

            return(androidHapticPlayer.GetDevices(force));
        }