private HapticHandle CreateHandle(SideOfHaptic side) { HapticHandle handle = null; if (TypeOfPlayable == PlayableType.Sequence) { HapticSequence seq = new HapticSequence(); seq.LoadFromAsset(PlayableResourceName); var areaFlag = side == SideOfHaptic.Left ? Where.Mirror() : Where; handle = seq.CreateHandle(areaFlag); } else if (TypeOfPlayable == PlayableType.Pattern) { HapticPattern pat = new HapticPattern(); pat.LoadFromAsset(PlayableResourceName); handle = pat.CreateHandle(); } else if (TypeOfPlayable == PlayableType.Experience) { HapticExperience exp = new HapticExperience(); exp.LoadFromAsset(PlayableResourceName); handle = exp.CreateHandle(); } else if (TypeOfPlayable == PlayableType.Impulse) { return(CreateImpulseHandle(side)); } return(handle); }
private HapticHandle CreateImpulseHandle(SideOfHaptic side) { if (TypeOfImpulse == ImpulseType.None) { return(null); } else if (TypeOfImpulse == ImpulseType.Emanation) { bool mirror = side == SideOfHaptic.Left; var impulse = ImpulseGenerator.BeginEmanatingEffect(mirror ? StartLocation.Mirror() : StartLocation, depth); HapticSequence seq = new HapticSequence(); seq.LoadFromAsset(HapticSequence); impulse.WithEffect(seq).WithAttenuation(attenuationPercentage).WithDuration(Duration); return(impulse.Play()); } else if (TypeOfImpulse == ImpulseType.Traversal) { bool mirror = side == SideOfHaptic.Left; var impulse = ImpulseGenerator.BeginTraversingImpulse( mirror ? StartLocation.Mirror() : StartLocation, mirror ? EndLocation.Mirror() : EndLocation); HapticSequence seq = new HapticSequence(); seq.LoadFromAsset(HapticSequence); impulse.WithEffect(seq).WithAttenuation(attenuationPercentage).WithDuration(Duration); return(impulse.Play()); } return(null); }
IEnumerator StomacheRumble() { gulpSource.volume = .85f; List <AreaFlag> locs = new List <AreaFlag>(); locs.Add(AreaFlag.Lower_Ab_Left); locs.Add(AreaFlag.Lower_Ab_Right); locs.Add(AreaFlag.Mid_Ab_Left); locs.Add(AreaFlag.Mid_Ab_Right); while (true) { AreaFlag loc = locs[Random.Range(0, locs.Count)]; string file = Random.Range(0, 1.0f) > .8f ? "Haptics/StomachRumbleHeavy" : "Haptics/StomachRumble"; HapticSequence seq = new HapticSequence(); seq.LoadFromAsset(file); seq.CreateHandle(loc).Play(); float waitDur = Random.Range(.05f, .15f); yield return(new WaitForSeconds(waitDur)); } }
/// <summary> /// [Helper function] Looks for a haptic sequence File - "Resources/Haptics/" + filename /// Identical to making a new HapticSequence and calling it's LoadFromAsset("Haptics/" + filename) function /// </summary> /// <param name="sequenceFile"></param> /// <returns></returns> public HapticSequence GetSequence(string sequenceFile) { HapticSequence seq = new HapticSequence(); seq.LoadFromAsset("Haptics/" + sequenceFile); return(seq); }
void Start() { seq = new HapticSequence(); //By using a double click we can distinctly hear the difference. seq.LoadFromAsset("Haptics/double_click"); //Play it on load to make sure it loaded. seq.Play(AreaFlag.All_Areas); }
void Start() { suit = HardlightSuit.Find(); mySequence.LoadFromAsset(sequenceFileName); handleList = new List <HapticHandle>(); if (SpherecastStartObject == null) { Debug.LogError("[Haptic Spherecast] - [" + name + "] has a null object for where it should begin.\n", this); } }
private void Start() { hapticOnDrawback.LoadFromAsset(drawHaptic); hapticOnRelease.LoadFromAsset(releaseHaptic); hapticwhilePulled.LoadFromAsset(pulledHapticName); pulledHandle = hapticwhilePulled.CreateHandle(); bowAnimation = GetComponent <BowAnimation>(); handle = GetComponentInChildren <BowHandle>(); interact = GetComponent <VRTK_InteractableObject>(); interact.InteractableObjectGrabbed += new InteractableObjectEventHandler(DoObjectGrab); }
void Start() { if (hapticFilesToPlay == null) { hapticFilesToPlay = new string[0]; } sequences = new HapticSequence[hapticFilesToPlay.Length]; for (int i = 0; i < hapticFilesToPlay.Length; i++) { HapticSequence seq = new HapticSequence(); seq.LoadFromAsset(hapticFilesToPlay[i]); sequences[i] = seq; } }
void Update() { //IF we should shock and we aren't currently if (ShouldShock && !CurrentlyShocking) { //Start the coroutine! StartCoroutine(ShockPlayer()); ShouldShock = false; } if (Input.GetKeyDown(KeyCode.G)) { HapticSequence seq = new HapticSequence(); seq.LoadFromAsset("Haptics/pulse"); seq.Play(AreaFlag.Left_All); } }
void Start() { explosionSequence.LoadFromAsset(hapticSequenceName); if (CreateAudioSFX) { if (source == null) { source = GetComponent <AudioSource>(); if (source == null) { source = gameObject.AddComponent <AudioSource>(); } } source.clip = AudioManager.Inst.FindOrLoadAudioClip(sfxName); source.volume = sfxVolume; source.enabled = true; } }
public void SetTriggerSequence(string sequenceName, string visibleName) { //HapticSequence newSeq = new HapticSequence(); try { LastSequence = new HapticSequence(); LastSequence.LoadFromAsset(sequenceName); greenBox.SetSequence(LastSequence); } catch (HapticsAssetException hExcept) { Debug.LogError("[Library Manager - Haptics Asset Exception] Exception while loading sequence - " + sequenceName + "\n\t" + hExcept.Message); } catch (System.Exception e) { Debug.LogError("[Exception] \n\tLoad failed and set was disallowed\n" + e.Message); } LastSequenceName = visibleName; greenBoxText.text = visibleName; }
protected virtual void Start() { SetBeeVisual(); sting.LoadFromAsset("Haptics/pain_short"); }
// Use this for initialization void Start() { BatHaptic.LoadFromAsset("Haptic/buzz"); HandPicker.SetActive(true); }
void Start() { jolt.LoadFromAsset("Haptics/heartbeat"); }
// Use this for initialization void Start() { rumbl.LoadFromAsset("Haptic/buzz"); buzz.LoadFromAsset("Haptic/fuzz"); }
void Start() { suit = HardlightSuit.Find(); mySequence.LoadFromAsset(sequenceFileName); }