refactor: Moved spawn logic to the presenter
This commit is contained in:
parent
859d34e3bb
commit
dd9640fc39
4 changed files with 9 additions and 67 deletions
|
@ -6,6 +6,8 @@ namespace Presenter {
|
|||
private readonly IExpressionInput _view;
|
||||
private readonly IRoseSpawner _spawner;
|
||||
|
||||
private bool CanSpawn => _model.Score % (_model.GrowIterations * _model.SpawnRate) == 0;
|
||||
|
||||
public ExpressionClick(Model model, IExpressionInput view, IRoseSpawner spawner) {
|
||||
_model = model;
|
||||
_view = view;
|
||||
|
@ -16,9 +18,9 @@ namespace Presenter {
|
|||
_model.AddScore();
|
||||
_view.UpdateView(_model.Score);
|
||||
|
||||
if (_model.NeedsToSpawn) {
|
||||
if (CanSpawn)
|
||||
_spawner.SpawnRose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue