Add charge throw mechanics; refactor bullet and brick components
This commit is contained in:
22
scripts/components/lifetime_component.gd
Normal file
22
scripts/components/lifetime_component.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
class_name LifetimeComponent
|
||||
extends Node
|
||||
|
||||
@export var root: Node
|
||||
@export var life_time: float = 5.0
|
||||
@export var timer: Timer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if not root:
|
||||
printerr("Root node not set.")
|
||||
return
|
||||
|
||||
if not timer:
|
||||
printerr("Timer node not set.")
|
||||
return
|
||||
|
||||
timer.timeout.connect(on_timer_timeout)
|
||||
|
||||
|
||||
func on_timer_timeout() -> void:
|
||||
root.queue_free()
|
Reference in New Issue
Block a user