generated from krampus/template-godot4
28 lines
804 B
GDScript3
28 lines
804 B
GDScript3
|
extends Level
|
||
|
|
||
|
@onready var alert_level_label: Label = %AlertLevelLabel
|
||
|
@onready var gunk_alarm: GunkAlarm = %GunkAlarm
|
||
|
|
||
|
|
||
|
func _ready() -> void:
|
||
|
if is_instance_valid(World.instance):
|
||
|
World.instance.manager.alert_raised.connect(_on_alert_level_raised)
|
||
|
World.instance.manager.alert_cleared.connect(_on_alert_level_cleared)
|
||
|
|
||
|
|
||
|
func _on_alert_level_raised(new_level: int) -> void:
|
||
|
alert_level_label.text = str(new_level)
|
||
|
|
||
|
|
||
|
func _on_alert_level_cleared() -> void:
|
||
|
alert_level_label.text = str(WorldManager.CLEAR_LEVEL)
|
||
|
|
||
|
|
||
|
func _unhandled_key_input(event: InputEvent) -> void:
|
||
|
if event.is_action_pressed("ui_page_up"):
|
||
|
if is_instance_valid(gunk_alarm):
|
||
|
gunk_alarm.trigger()
|
||
|
if event.is_action_pressed("ui_page_down"):
|
||
|
if is_instance_valid(World.instance):
|
||
|
World.instance.manager.clear_alert()
|