Beispiel #1
0
 private void BowFullyDrawnHaptic()
 {
     if (HapticEffectWhenDrawAndReleased)
     {
         if (currentPull > maxPullDistance * pulledHapticPullThreshold && !pulled)
         {
             pulled = true;
             var impulse = ImpulseGenerator.BeginEmanatingEffect(WhichSide, 2);
             impulse.WithEffect(hapticOnDrawback).WithDuration(.25f).WithAttenuation(.5f);
             pulledHandle = impulse.Play();
         }
         else if (currentPull > maxPullDistance * pulledHapticPullThreshold && pulled)
         {
             pulledHapticCounter += Time.deltaTime;
             if (pulledHapticCounter > .25f)
             {
                 pulledHapticCounter = 0;
                 pulledHandle.Replay();
             }
         }
         else if (currentPull < maxPullDistance * pulledHapticPullThreshold * .5f)
         {
             pulled = false;
         }
     }
 }
 public void Restart()
 {
     if (handle == null)
     {
         Play();
     }
     else
     {
         handle.Replay();
     }
 }