From 339b62faf7179265d0ff811bbe0aa71c4c4c478f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?= <52170489+GerardGascon@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:16:55 +0200 Subject: [PATCH] feat: loading spawned roses --- Assets/Scripts/Presenter/SaveSystem/LoadGame.cs | 8 ++++++-- Assets/Scripts/View/Dependencies.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Presenter/SaveSystem/LoadGame.cs b/Assets/Scripts/Presenter/SaveSystem/LoadGame.cs index ac71a93..3d6755c 100644 --- a/Assets/Scripts/Presenter/SaveSystem/LoadGame.cs +++ b/Assets/Scripts/Presenter/SaveSystem/LoadGame.cs @@ -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 diff --git a/Assets/Scripts/View/Dependencies.cs b/Assets/Scripts/View/Dependencies.cs index 9793838..3148081 100644 --- a/Assets/Scripts/View/Dependencies.cs +++ b/Assets/Scripts/View/Dependencies.cs @@ -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