Add NotificationManager and NotificationLabel for age advancement notifications; refactor scripts into Components directory

This commit is contained in:
2025-08-23 04:54:45 +02:00
parent 5719c3f920
commit 9cf707945b
26 changed files with 96 additions and 68 deletions

View File

@@ -0,0 +1,31 @@
using Godot;
using ParasiticGod.Scripts;
using ParasiticGod.Scripts.Singletons;
namespace ParasiticGod.Scripts.Components;
[GlobalClass]
public partial class NotificationManager : CanvasLayer
{
[Export] private PackedScene _notificationLabelScene;
public override void _Ready()
{
GameBus.Instance.AgeAdvanced += OnAgeAdvanced;
}
public override void _ExitTree()
{
if (GameBus.Instance != null)
{
GameBus.Instance.AgeAdvanced -= OnAgeAdvanced;
}
}
private void OnAgeAdvanced(string ageName)
{
var notification = _notificationLabelScene.Instantiate<NotificationLabel>();
AddChild(notification);
notification.ShowNotification($"You have entered\n{ageName}!");
}
}