extends CanvasLayer @export var player: Node3D var timeout: float = 0 var timeout_counter: float = 0 # Called when the node enters the scene tree for the first time. #func _ready() -> void: # pass # Replace with function body. func have_toast() -> bool: return timeout > 0 func set_toast(text: String, p_timeout: float) -> void: $Toast.text = text if p_timeout != 0: timeout = p_timeout timeout_counter = 0 # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: $Ammo.text = "Ammo " + str(player.ammo) if timeout > 0: if timeout_counter < timeout: timeout_counter += delta else: $Toast.text = "" timeout = 0