Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private float Test1()
- {
- SimpleTimer.Create(3f, () =>
- {
- //Do something
- });
- }
- //increase the pitch if 5 seconds have not elapsed since the last call. Otherwise return restarted pitch
- private static SimpleTimer _timer;
- private static float _currentPitch = 1f;
- private float GetPitch()
- {
- if (_timer == null)
- {
- _timer = SimpleTimer.Create(5f, () =>
- {
- _currentPitch = 1f;
- _timer = null;
- });
- }
- _timer.Restart();
- _currentPitch = Mathf.Clamp(_currentPitch + 0.05f, 1f, 2f);
- return _currentPitch;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement