Commit 339b62fa authored by Gerard Gascón's avatar Gerard Gascón
Browse files

feat: loading spawned roses

parent 2562567f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -5,11 +5,13 @@ namespace Presenter.SaveSystem {
		private readonly IGameRepository _repository;
		private readonly Score _score;
		private readonly IExpressionInput _expressionInput;
		private readonly IRoseSpawner _spawner;

		public LoadGame(IGameRepository repository, Score score, IExpressionInput expressionInput) {
		public LoadGame(IGameRepository repository, Score score, IExpressionInput expressionInput, IRoseSpawner spawner) {
			_repository = repository;
			_score = score;
			_expressionInput = expressionInput;
			_spawner = spawner;
		}

		public void Run() {
@@ -17,7 +19,9 @@ namespace Presenter.SaveSystem {
			_score.SetFromOtherScore(newScore);
			_expressionInput.UpdateView(_score.Value, _score.GrowPercentage);

			//spawn roses = _score.Value / (_score.SpawnRate * _score.GrowInteractions)
			int roses = _score.Value / (_score.SpawnRate * _score.GrowIterations);
			for (int i = 0; i < roses; i++)
				_spawner.SpawnRose();
		}
	}
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ namespace View {

			PlayerPrefsRepository repository = new();
			Saver = new SaveGame(repository, Score);
			Loader = new LoadGame(repository, Score, inputCollections);
			Loader = new LoadGame(repository, Score, inputCollections, spawner);
		}
	}
}
 No newline at end of file