307 {
308
309 static uint32_t nextTrigger = 0;
310
311
312 uint32_t trigger_delta = nextTrigger - now;
313
314
315 if (trigger_delta > 10000) {
316
317 trigger_delta = 0;
318 }
319
320
322
323 if (now >= nextTrigger) {
324
326
327
328
330
331
332
333 uint32_t min_rand = 400 *
speed;
334 uint32_t max_rand = 2000 *
speed;
335
336
337 uint32_t min =
MIN(min_rand, max_rand);
338 uint32_t max =
MAX(min_rand, max_rand);
339
340
341 if (min == max) {
342 max += 1;
343 }
344
345
346 nextTrigger = now + random(min, max);
347 }
348 }
349}
UISlider speed("Speed", 1.0f, -20.0f, 20.0f, 0.01f)
UICheckbox autoTrigger("Auto Trigger", true)
UISlider triggerSpeed("Trigger Speed",.5f, 0.0f, 1.0f, 0.01f)