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); }
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(); } } }
/// <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); } }
public virtual void Stop() { var haptic = BhapticsManager.GetHaptic(); if (haptic != null) { haptic.TurnOff(); } }
private static void OnUpdateDevicesChange(List <HapticDevice> devices) { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.UpdateDeviceList(devices); }
public static void Pair(string address, string position = "") { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.Pair(address, position); }
public static void UnpairAll() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.UnpairAll(); }
public static void TogglePosition(string address) { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.TogglePosition(address); }
public static void ShowBluetoothSetting() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.ShowBluetoothSetting(); }
public static void ToggleStreaming() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.ToggleStreaming(); }
public static void Unpair(string address) { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.Unpair(address); }
public virtual bool IsPlaying() { var haptic = BhapticsManager.GetHaptic(); if (haptic == null) { return(false); } return(haptic.IsPlaying(keyId)); }
public static void RequestPermission() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.RequestPermission(); }
public static void ToggleEnableDevice(HapticDevice device) { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.EnableDevice(device.Address, !device.IsEnable); }
public static void ScanStop() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.StopScan(); }
public static bool IsStreaming() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return(false); } return(androidHapticPlayer.IsStreamingEnable()); }
public static void Ping(HapticDevice device) { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.Ping(device.Address); }
public static List <AndroidUtils.StreamHost> GetStreamingHosts() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return(new List <AndroidUtils.StreamHost>()); } return(androidHapticPlayer.GetStreamingHosts()); }
/// <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)); }
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); }
void OnApplicationFocus(bool pauseStatus) { if (pauseStatus) { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } androidHapticPlayer.RefreshPairingInfo(); } }
public static void Scan() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } if (!androidHapticPlayer.IsScanning()) { androidHapticPlayer.StartScan(); } }
public static void Scan() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null || !AndroidPermissionsManager.CheckBluetoothPermissions()) { return; } if (!androidHapticPlayer.IsScanning()) { androidHapticPlayer.StartScan(); } }
private static void RefreshDeviceListUi() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { return; } if (Instance != null) { Instance.InvokeRefresh(); } }
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(); } }
public static bool CheckPermission() { var androidHapticPlayer = BhapticsManager.GetHaptic() as AndroidHaptic; if (androidHapticPlayer == null) { if (pcAndoidTestMode) { return(true); } return(false); } return(androidHapticPlayer.CheckPermission()); }
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); } }
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)); }
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); } }
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)); }