Пример #1
0
 private void addVibration(float strength, float duration, bool overrideAllOthers, VibrationRequest vr)
 {
     if (vr == null)
     {
         vr = new VibrationRequest(duration, strength, steamVRController, this);
     }
     if (overrideAllOthers || vibrationQueue.Count == 0)
     {
         vibrationQueue = new List <VibrationRequest>();
         vibrationQueue.Add(vr);
     }
     else if (vibrationQueue.Count > 0)
     {
         // If the new requested vibration is harder then current, override //
         if (vibrationQueue[0].vibrateStrength < vr.vibrateStrength)
         {
             // Current request will last longer then new request //
             if (vibrationQueue[0].stopVibratingAt > duration)
             {
                 // Move current request behind new request //
                 vibrationQueue[1] = vibrationQueue[0];
                 vibrationQueue[0] = vr;
             }
         }
     }
     vibrate = true;
 }
Пример #2
0
 public void addVibration(VibrationRequest vr, bool overrideAllOthers)
 {
     addVibration(0, 0, overrideAllOthers, vr);
 }