30 lines
No EOL
875 B
C#
30 lines
No EOL
875 B
C#
using Domain;
|
|
|
|
namespace Presenter.SaveSystem {
|
|
public class LoadGame {
|
|
private readonly IGameRepository _repository;
|
|
private readonly Score _score;
|
|
private readonly IScoreView _scoreView;
|
|
private readonly IRoseSpawner _spawner;
|
|
private readonly IRoseGrow _growAnimation;
|
|
|
|
public LoadGame(IGameRepository repository, Score score, IScoreView scoreView, IRoseSpawner spawner, IRoseGrow growAnimation) {
|
|
_repository = repository;
|
|
_score = score;
|
|
_scoreView = scoreView;
|
|
_spawner = spawner;
|
|
_growAnimation = growAnimation;
|
|
}
|
|
|
|
public void Run() {
|
|
Score newScore = _repository.LoadScore();
|
|
_score.SetFromOtherScore(newScore);
|
|
_scoreView.UpdateView(_score.Value);
|
|
_growAnimation.GrowStep();
|
|
|
|
int roses = _score.Value / (_score.SpawnRate * _score.GrowIterations);
|
|
for (int i = 0; i < roses; i++)
|
|
_spawner.SpawnRose();
|
|
}
|
|
}
|
|
} |