blob: f1662a70f33deeba1a751f0c9903461a44bee8c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
class_name Effect
extends Node
signal duration_finished
signal tick_finished
var duration: float = 0.0
var DurationTimer: Timer
var tick: float = 0.0
var TickTimer: Timer
func _ready():
pass
func set_duration(value: float):
duration = value
if not DurationTimer:
DurationTimer = Timer.new()
DurationTimer.timeout.connect(func():
duration_finished.emit()
queue_free()
)
add_child(DurationTimer)
DurationTimer.wait_time = duration
DurationTimer.start()
func set_tick(value: float):
tick = value
if not TickTimer:
TickTimer = Timer.new()
TickTimer.timeout.connect(func():
tick_finished.emit()
TickTimer.start()
)
add_child(TickTimer)
TickTimer.wait_time = tick
TickTimer.start()
|