refactor: moved grow animation to its own class
This commit is contained in:
parent
150b602dc3
commit
779af276d3
14 changed files with 224 additions and 116 deletions
|
@ -5,28 +5,28 @@ namespace Presenter {
|
|||
private readonly Score _score;
|
||||
private readonly IExpressionInput _view;
|
||||
private readonly IRoseGrow _grow;
|
||||
private readonly IInputCallback _onInputReceived;
|
||||
private readonly IRoseSpawner _spawner;
|
||||
|
||||
private bool CanSpawn => _score.Value % (_score.GrowIterations * _score.SpawnRate) == 0;
|
||||
|
||||
public ExpressionClick(Score score, IExpressionInput view, IRoseSpawner spawner, IRoseGrow grow) {
|
||||
public ExpressionClick(Score score, IExpressionInput view, IRoseSpawner spawner, IRoseGrow grow, IInputCallback inputCallback) {
|
||||
_score = score;
|
||||
_view = view;
|
||||
_spawner = spawner;
|
||||
_grow = grow;
|
||||
_onInputReceived = inputCallback;
|
||||
}
|
||||
|
||||
public void Execute() {
|
||||
_score.Add();
|
||||
_view.UpdateView(_score.Value, _score.GrowPercentage);
|
||||
_grow.Grow();
|
||||
|
||||
_onInputReceived.OnInputReceived();
|
||||
|
||||
if (CanSpawn)
|
||||
_spawner.SpawnRose();
|
||||
else if (_score.Value % _score.GrowIterations == 0)
|
||||
if (_score.Value % _score.GrowIterations == 0)
|
||||
_grow.GrowStep();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue