SHARE
TWEET

Untitled

a guest Oct 21st, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private float Test1()
  2. {
  3.     SimpleTimer.Create(3f, () =>
  4.     {
  5.         //Do something
  6.     });
  7. }
  8.  
  9. //increase the pitch if 5 seconds have not elapsed since the last call. Otherwise return restarted pitch
  10. private static SimpleTimer _timer;
  11. private static float _currentPitch = 1f;
  12. private float GetPitch()
  13. {
  14.     if (_timer == null)
  15.     {
  16.         _timer = SimpleTimer.Create(5f, () =>
  17.         {
  18.             _currentPitch = 1f;
  19.             _timer = null;
  20.         });
  21.     }
  22.     _timer.Restart();
  23.  
  24.     _currentPitch = Mathf.Clamp(_currentPitch + 0.05f, 1f, 2f);
  25.     return _currentPitch;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top