- Implemented support for fixed process on timer. Useful for cooldowns without the influence from framerate
similar to animation player (idle/fixed mode), where idle mode = old timer, fixed mode = fixed process implementation: Example of the behaviour with a stream of bullets with timers on different frame rates: https://gfycat.com/HeartyImpressiveIndiancow - A change for more uniform ticks on fixed/idle without this fix: http://i.imgur.com/0TMQ6CG.png with this fix: http://i.imgur.com/3zYx16c.png
This commit is contained in:
@ -46,6 +46,11 @@ protected:
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
enum TimerProcessMode {
|
||||
TIMER_PROCESS_FIXED,
|
||||
TIMER_PROCESS_IDLE,
|
||||
};
|
||||
|
||||
void set_wait_time(float p_time);
|
||||
float get_wait_time() const;
|
||||
|
||||
@ -60,7 +65,16 @@ public:
|
||||
|
||||
float get_time_left() const;
|
||||
|
||||
void set_timer_process_mode(TimerProcessMode p_mode);
|
||||
TimerProcessMode get_timer_process_mode() const;
|
||||
Timer();
|
||||
|
||||
private:
|
||||
TimerProcessMode timer_process_mode;
|
||||
void _set_process(bool p_process, bool p_force = false);
|
||||
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Timer::TimerProcessMode);
|
||||
|
||||
#endif // TIMER_H
|
||||
|
||||
Reference in New Issue
Block a user