immersive-home/content/ui/menu/menu.gd

29 lines
802 B
GDScript3
Raw Normal View History

2023-10-30 02:21:50 +02:00
extends Node3D
2023-12-13 23:22:52 +02:00
const Notification = preload("res://content/ui/components/notification/notification.tscn")
2023-11-28 00:46:05 +02:00
@onready var animation_player = $AnimationPlayer
2023-12-13 23:22:52 +02:00
@onready var notify_place = $AnimationContainer/NotifyPlace
2023-11-16 20:23:17 +02:00
2024-01-15 17:47:09 +02:00
var show_menu := false:
set(value):
show_menu = value
if value:
animation_player.play_backwards("hide_menu")
AudioPlayer.play_effect("open_menu")
else:
animation_player.play("hide_menu")
AudioPlayer.play_effect("close_menu")
2023-10-30 02:21:50 +02:00
func _ready():
2023-12-13 23:22:52 +02:00
EventSystem.on_notify.connect(func(event: EventNotify):
var notification_node = Notification.instantiate()
notification_node.text = event.message
notification_node.type = event.type
for child in notify_place.get_children():
child.position += Vector3(0, 0, -0.06)
notify_place.add_child(notification_node)
)