feat: loading spawned roses

This commit is contained in:
Gerard Gascón 2024-04-17 10:16:55 +02:00
parent 2562567f47
commit 339b62faf7
2 changed files with 7 additions and 3 deletions

View file

@ -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();
}
}
}

View file

@ -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);
}
}
}