public void Hit(float damage) { if (won) { return; } //Update player health this.health -= damage; //Play hurt noise if (this.IsAlive()) { GameObject.Find("otherSounds").transform.Find("playerHurt").GetComponent <AudioSource>().Play(); } if (!this.IsAlive()) { return; } //Flash screen red StartCoroutine(this.FadeOut()); //Vibrate byte[] noise = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }; OVRHaptics.Channels[0].Preempt(new OVRHapticsClip(noise, noise.Length)); OVRHaptics.Channels[1].Preempt(new OVRHapticsClip(noise, noise.Length)); OVRHaptics.Process(); }
private void OnCollisionEnter(Collision other) { if (other.gameObject) { OVRHaptics.Mix(hapticsClip); } }
public void Vibrate(VibrationForce vibrationForce) { //var channel = OVRHaptics.RightChannel; //if (controllerMask == OVRInput.Controller.LTouch) // channel = OVRHaptics.LeftChannel; //channel = OVRHaptics.Channels[1]; //switch (vibrationForce) //{ // case VibrationForce.Light: // channel.Preempt(clipLight); // break; // case VibrationForce.Medium: // channel.Preempt(clipMedium); // break; // case VibrationForce.Hard: // channel.Preempt(clipHard); // break; //} OVRHaptics.Channels[0].Clear(); OVRHaptics.Channels[1].Clear(); if (vibrationForce == VibrationForce.Light) { noize = new byte[10] { 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 } } ; else if (vibrationForce == VibrationForce.Medium) { noize = new byte[10] { 120, 120, 120, 120, 120, 120, 120, 120, 120, 120 } } ; else { noize = new byte[10] { 240, 240, 240, 240, 240, 240, 240, 240, 240, 240 } }; OVRHaptics.Channels[1].Preempt(new OVRHapticsClip(noize, 10)); OVRHaptics.Process(); }
private void LateUpdate() { OVRHaptics.Process(); }
void LateUpdate() { // Perform a manual update of OVR haptics OVRHaptics.Process(); }