33 lines
No EOL
911 B
C#
33 lines
No EOL
911 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();
|
|
|
|
for (int i = 0; i < _score.Roses; i++) {
|
|
if (_score.Roses > Score.InitialRosesThreshold)
|
|
_spawner.SpawnRose();
|
|
else
|
|
_spawner.SpawnInitialRose();
|
|
}
|
|
}
|
|
}
|
|
} |