Files
redglow e7dbb9cabb .
2026-07-21 20:49:24 +02:00

20 lines
656 B
C#

using GodotHostTest.Helpers;
using GodotHostTest.Interfaces;
using R3;
namespace GodotHostTest.Game.Target;
public class TargetEventBus : ITargetEventBus
{
private readonly Pipe<Unit> _hitOutPipe = new();
private readonly Pipe<Unit> _timedOutPipe = new();
public Observable<Unit> TimedOut => _timedOutPipe.Observable;
public Observable<Unit> Hit => _hitOutPipe.Observable;
public void NewTargetSpawner(ITargetSpawner targetSpawner)
{
_timedOutPipe.PipeIn(targetSpawner.TargetSpawned.SelectMany(target => target.TimedOut));
_hitOutPipe.PipeIn(targetSpawner.TargetSpawned.SelectMany(target => target.Hit));
}
}