feat: working version with scopes.
This commit is contained in:
+5
-5
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user