21 lines
359 B
GDScript
21 lines
359 B
GDScript
|
|
class_name Counter extends RefCounted
|
||
|
|
|
||
|
|
var is_active: bool = false
|
||
|
|
|
||
|
|
var sec: float = 1
|
||
|
|
var value: float = 0
|
||
|
|
|
||
|
|
|
||
|
|
func is_reached() -> bool:
|
||
|
|
if value >= sec:
|
||
|
|
return true
|
||
|
|
else:
|
||
|
|
return false
|
||
|
|
|
||
|
|
func add_delta(delta: float) -> void:
|
||
|
|
value += delta
|
||
|
|
|
||
|
|
|
||
|
|
func debug() -> void:
|
||
|
|
print(is_active, " | ", value, " of ", sec)
|