23 _inv_cycle_time(1./30),
37 TimedCycle(PN_stdfloat cycle_time,
int element_count) :
38 _cycle_time(cycle_time),
40 _element_count(element_count)
42 nassertv(_cycle_time > 0);
45 _inv_cycle_time = 1. / _cycle_time;
56 _element_count = element_count;
67 nassertv(cycle_time > 0);
68 if (_next_switch == -1)
74 _next_switch = _next_switch - _cycle_time + cycle_time;
76 _cycle_time = cycle_time;
77 _inv_cycle_time = 1. / _cycle_time;
90 unsigned int increment = (
unsigned int) ((current_time - _next_switch)
93 _next_switch += _cycle_time * increment;
94 _current_child = (_current_child + increment) % _element_count;
96 return _current_child;
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
double get_frame_time(Thread *current_thread=Thread::get_current_thread()) const
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
void set_element_count(int element_count)
Set the number of elements being cycled through.
int next_element()
Set the number of elements being cycled through.
void set_cycle_time(PN_stdfloat cycle_time)
Set the number of elements being cycled through.