Skip to content

timer_countdown

Kamran Wali edited this page Dec 2, 2024 · 4 revisions

Inherits: base_timer

Inherited By: timer_countdown_time

Description

timer_countdown is the script that counts down from a given second to 0.

Tutorial

Properties

Type Name Default Value
float _time_set
float _time_current

Methods

Return Type Name
void set_time( float time_seconds )
bool is_timer_done()
float normalized()
float get_current_time_seconds()
void reset_timer()
void stop_timer()
float get_time_seconds()
void update_timer(float delta)

Property Descriptions

float _time_set

This property stores the main maximum time given to this script.

Note: The time is stored in seconds.


float _time_current

This property is the time that will count down to 0

Note: The count down time is done in seconds.


Method Descriptions

void set_time ( float time_seconds )

This method sets/overrides the timer's time. Both _time_set and _time_current is set to the given time_seconds parameter value.


bool is_timer_done ()

This method checks if the timer is done counting down. True means the timer is done counting down. False means the timer is NOT done counting down.

Note: When counting down is done the property _time_current then equals to _time_set.


float normalized ()

This method gets the normalized value of the time in timer, range 0.0 - 1.0. This value can be used to synchronize with other features. The normalized value is calculated by dividing _time_current with _time_set.


float get_current_time_seconds ()

This method returns the value of _time_current.


void reset_timer ()

This method resets the timer. This means _time_current will be set to 0.0.


void stop_timer ()

This method stops the timer. The timer is stopped by making _time_current equal to _time_set.


float get_time_seconds ()

This method returns _time_set value.


void update_timer ( float delta )

This method updates the timer by counting down the timer. This method MUST be called from other scripts for the countdown to work.


Clone this wiki locally