feat: new ValueProvider improvements and source generator.
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
using Godot;
|
||||
using GodotHostTest.AetherBind;
|
||||
using GodotHostTest.Interfaces;
|
||||
using OwofGames.AetherBind;
|
||||
using R3;
|
||||
|
||||
namespace GodotHostTest.Game.Target;
|
||||
|
||||
[Injected]
|
||||
public partial class Target : Node2D, ITarget
|
||||
{
|
||||
private readonly Subject<Unit> _hit = new();
|
||||
@@ -17,7 +15,7 @@ public partial class Target : Node2D, ITarget
|
||||
[Export] public double TimeOutDurationInSeconds;
|
||||
[Export] public required Timer TimeOutTimer;
|
||||
|
||||
[Inject] private IValueGetter<ITargetCollector> _targetCollector = null!;
|
||||
[Inject] private ITargetCollector _targetCollector = null!;
|
||||
|
||||
public Observable<Unit> TimedOut => _timedOut.AsObservable();
|
||||
|
||||
@@ -32,7 +30,7 @@ public partial class Target : Node2D, ITarget
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_targetCollector.Value.NewTarget(this);
|
||||
_targetCollector.NewTarget(this);
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using Godot;
|
||||
using GodotHostTest.Helpers;
|
||||
using GodotHostTest.Interfaces;
|
||||
using OwofGames.AetherBind;
|
||||
using R3;
|
||||
|
||||
namespace GodotHostTest.Game.Target;
|
||||
@@ -11,10 +12,10 @@ public partial class TargetSpawner : Node2D, ITargetCollector, ITargetSpawner
|
||||
private readonly List<ITarget> _availableTargets = [];
|
||||
|
||||
private readonly Subject<ITarget> _targetSpawned = new();
|
||||
[Export] public double TimeBetweenSpawns;
|
||||
|
||||
[Export] public required Timer Timer;
|
||||
|
||||
[Inject] private ILevel _level = null!;
|
||||
|
||||
public void NewTarget(ITarget target)
|
||||
{
|
||||
_availableTargets.Add(target);
|
||||
@@ -26,7 +27,7 @@ public partial class TargetSpawner : Node2D, ITargetCollector, ITargetSpawner
|
||||
public override void _Ready()
|
||||
{
|
||||
Spawn();
|
||||
Timer.Start(TimeBetweenSpawns);
|
||||
Timer.Start(_level.TimeBetweenSpawns.TotalSeconds);
|
||||
}
|
||||
|
||||
private void MakeTargetAvailable(ITarget target)
|
||||
|
||||
Reference in New Issue
Block a user