public NotifyPathAggregateWhenEnemiesAreSpawned(EnemiesAggregate enemy, PathFinderAggregate pathFinder) { enemy.Events .OfType <EnemiesEvent, EnemiesEvent.EnemySpawned>() .DelayFrame(1) .Subscribe(spawned => HandleEnemiesSpawnedEvent(spawned, pathFinder)); }
public NotifyPathAggregateWhenCellsAreOccupied(MapAggregate map, TowersAggregate tower, WallsAggregate wall, [NotNull] PathFinderAggregate pathFinder) { _pathFinder = pathFinder ?? throw new ArgumentNullException(nameof(pathFinder)); map.Events.OfType <MapEvent, MapEvent.Initialized>().Subscribe(HandleMapInitialized); tower.Events.OfType <TowersEvent, TowersEvent.TowerRepaired>().Subscribe(HandleTowerRepaired); wall.Events.OfType <WallsEvent, WallsEvent.WallRepaired>().Subscribe(HandleWallRepaired); }
private void HandleEnemiesSpawnedEvent(EnemiesEvent.EnemySpawned e, PathFinderAggregate pathFinder) { pathFinder.AddEnemy(e.EnemyId); }