refactor: moved grow animation to its own class

This commit is contained in:
Gerard Gascón 2024-04-19 11:26:44 +02:00
parent 150b602dc3
commit 779af276d3
14 changed files with 224 additions and 116 deletions

View file

@ -6,18 +6,21 @@ namespace Presenter.SaveSystem {
private readonly Score _score;
private readonly IExpressionInput _expressionInput;
private readonly IRoseSpawner _spawner;
private readonly IRoseGrow _growAnimation;
public LoadGame(IGameRepository repository, Score score, IExpressionInput expressionInput, IRoseSpawner spawner) {
public LoadGame(IGameRepository repository, Score score, IExpressionInput expressionInput, IRoseSpawner spawner, IRoseGrow growAnimation) {
_repository = repository;
_score = score;
_expressionInput = expressionInput;
_spawner = spawner;
_growAnimation = growAnimation;
}
public void Run() {
Score newScore = _repository.LoadScore();
_score.SetFromOtherScore(newScore);
_expressionInput.UpdateView(_score.Value, _score.GrowPercentage);
_growAnimation.GrowStep();
int roses = _score.Value / (_score.SpawnRate * _score.GrowIterations);
for (int i = 0; i < roses; i++)