32 lines
No EOL
750 B
C#
32 lines
No EOL
750 B
C#
using Domain;
|
|
|
|
namespace Presenter {
|
|
public class ExpressionClick {
|
|
private readonly Score _score;
|
|
private readonly IExpressionInput _view;
|
|
private readonly IRoseGrow _grow;
|
|
private readonly IRoseSpawner _spawner;
|
|
|
|
private bool CanSpawn => _score.Value % (_score.GrowIterations * _score.SpawnRate) == 0;
|
|
|
|
public ExpressionClick(Score score, IExpressionInput view, IRoseSpawner spawner, IRoseGrow grow) {
|
|
_score = score;
|
|
_view = view;
|
|
_spawner = spawner;
|
|
_grow = grow;
|
|
}
|
|
|
|
public void Execute() {
|
|
_score.Add();
|
|
_view.UpdateView(_score.Value, _score.GrowPercentage);
|
|
_grow.Grow();
|
|
|
|
|
|
if (CanSpawn)
|
|
_spawner.SpawnRose();
|
|
else if (_score.Value % _score.GrowIterations == 0)
|
|
_grow.GrowStep();
|
|
}
|
|
|
|
}
|
|
} |