feat: working version with scopes.

This commit is contained in:
redglow
2026-07-18 12:09:43 +02:00
parent 23e160438f
commit 04f0b5ef16
15 changed files with 120 additions and 87 deletions
+5 -5
View File
@@ -1,22 +1,24 @@
using R3;
using Godot;
using GodotHostTest.GodotDI;
using GodotHostTest.Helpers;
using GodotHostTest.Interfaces;
using R3;
namespace GodotHostTest.Game;
public partial class Score : Control, IScore
{
[Inject] private readonly IValueGetter<ITargetSpawner> _targetSpawner = null!;
[Export] private AnimationPlayer _animationPlayer = null!;
[Export] private Label _label = null!;
[Inject] private readonly ITargetSpawner _targetSpawner = null!;
private int _score;
int IScore.Score => _score;
public override void _Ready()
{
_targetSpawner.TargetSpawned.Subscribe(OnTargetSpawned).AddTo(this);
_targetSpawner.Value.TargetSpawned.Subscribe(OnTargetSpawned).AddTo(this);
base._Ready();
}
@@ -34,6 +36,4 @@ public partial class Score : Control, IScore
{
_label.Text = $"Score: {_score}";
}
int IScore.Score => _score;
}