public GridOverlayViewModel(ICoordinateService coordinateService, IWorldConfigRepository loadedWorldConfigRepository, IMapConfigRepository mapConfigRepository, ITilesPositionService tilesPositionService, Transform centerTransform) { CoordinateVisibilityLiveData = new LiveData <bool>(true); GridVisibilityLiveData = new LiveData <bool>(true); CellsCountLiveData = new LiveData <int>(); CellsPositionLiveData = new LiveData <IReadOnlyList <Vector3> >(); WorldConfigLiveData = new LiveData <WorldConfig>(); CoordinatesLiveData = new LiveData <IReadOnlyList <Coordinate> >(); _compositeDisposable = new CompositeDisposable { mapConfigRepository.GetObservableStream() .CombineLatest( loadedWorldConfigRepository.GetObservableStream(), tilesPositionService.GetObservableStream(centerTransform.position.y), (mapConfig, worldConfig, positions) => (mapConfig, worldConfig, positions) ) .Subscribe( tuple => { var(mapConfig, worldConfig, positions) = tuple; var coordinates = coordinateService.GetFlattenCoordinates(mapConfig); UpdateCellsCountsWhenNeeded(coordinates.Count); UpdateCellsPositionWhenNeeded(positions); UpdateWorldConfigWhenNeeded(worldConfig); UpdateCoordinatesWhenNeeded(coordinates); } ) }; }