breadwinner/scenes/player/flashlight_component.gd
Hellie-xd 0a764354ba did a shitton of refactoring.
still has bugs, but almost works like the original, but has much better
structure. still might have to change around a bit, but closing in to
the final form.
2026-08-09 03:24:28 +02:00

17 lines
481 B
GDScript

class_name FlashlightComponent extends Node
@export var flashlight: SpotLight3D
var flashlight_on: bool = true
var flashlight_charge: float = 100.0
func toggle_flashlight():
flashlight_on = !flashlight_on
flashlight.visible = flashlight_on
func _process(delta: float) -> void:
if flashlight_on and flashlight_charge > 0:
flashlight_charge = move_toward(flashlight_charge, 0, .2 * delta)
func _ready() -> void:
GlobalSignals.toggle_flashlight.connect(toggle_flashlight)