Loading Assets/Scenes/SampleScene.unity +2 −2 Original line number Diff line number Diff line Loading @@ -831,8 +831,8 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: 8bf485ced708a3743b05e49780fcf878, type: 3} m_SortingOrder: -1 m_Sprite: {fileID: 21300000, guid: 9190f771caed674408c4b6d4b619af7e, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 Loading Assets/Scripts/Domain/Model.cs +18 −3 Original line number Diff line number Diff line Loading @@ -2,12 +2,27 @@ public class Model { public int Score { private set; get; } public Model(int score) { private readonly int _spawnRate; private bool _needsToSpawn; public Model(int spawnRate) : this(0, spawnRate) { } public Model(int score, int spawnRate) { Score = score; _spawnRate = spawnRate; } public void AddScore(int score) { Score += score; public void AddScore() { Score++; if (Score % _spawnRate == 0) _needsToSpawn = true; } public bool NeedsToSpawn() { bool needs = _needsToSpawn; _needsToSpawn = false; return needs; } } } No newline at end of file Assets/Scripts/Presenter/ExpressionClick.cs +8 −2 Original line number Diff line number Diff line Loading @@ -4,15 +4,21 @@ namespace Presenter { public class ExpressionClick { private readonly Model _model; private readonly IExpressionInput _view; private readonly IRoseSpawner _spawner; public ExpressionClick(Model model, IExpressionInput view) { public ExpressionClick(Model model, IExpressionInput view, IRoseSpawner spawner) { _model = model; _view = view; _spawner = spawner; } public void Execute() { _model.AddScore(1); _model.AddScore(); _view.UpdateView(_model.Score); if (_model.NeedsToSpawn()) { _spawner.SpawnRose(); } } } } No newline at end of file Assets/Scripts/Presenter/IRoseSpawner.cs 0 → 100644 +5 −0 Original line number Diff line number Diff line namespace Presenter { public interface IRoseSpawner { void SpawnRose(); } } No newline at end of file Assets/Scripts/Presenter/IRoseSpawner.cs.meta 0 → 100644 +3 −0 Original line number Diff line number Diff line fileFormatVersion: 2 guid: 24fa8325e763470c8e412f76eeb46b59 timeCreated: 1713197911 No newline at end of file Loading
Assets/Scenes/SampleScene.unity +2 −2 Original line number Diff line number Diff line Loading @@ -831,8 +831,8 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: 8bf485ced708a3743b05e49780fcf878, type: 3} m_SortingOrder: -1 m_Sprite: {fileID: 21300000, guid: 9190f771caed674408c4b6d4b619af7e, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 Loading
Assets/Scripts/Domain/Model.cs +18 −3 Original line number Diff line number Diff line Loading @@ -2,12 +2,27 @@ public class Model { public int Score { private set; get; } public Model(int score) { private readonly int _spawnRate; private bool _needsToSpawn; public Model(int spawnRate) : this(0, spawnRate) { } public Model(int score, int spawnRate) { Score = score; _spawnRate = spawnRate; } public void AddScore(int score) { Score += score; public void AddScore() { Score++; if (Score % _spawnRate == 0) _needsToSpawn = true; } public bool NeedsToSpawn() { bool needs = _needsToSpawn; _needsToSpawn = false; return needs; } } } No newline at end of file
Assets/Scripts/Presenter/ExpressionClick.cs +8 −2 Original line number Diff line number Diff line Loading @@ -4,15 +4,21 @@ namespace Presenter { public class ExpressionClick { private readonly Model _model; private readonly IExpressionInput _view; private readonly IRoseSpawner _spawner; public ExpressionClick(Model model, IExpressionInput view) { public ExpressionClick(Model model, IExpressionInput view, IRoseSpawner spawner) { _model = model; _view = view; _spawner = spawner; } public void Execute() { _model.AddScore(1); _model.AddScore(); _view.UpdateView(_model.Score); if (_model.NeedsToSpawn()) { _spawner.SpawnRose(); } } } } No newline at end of file
Assets/Scripts/Presenter/IRoseSpawner.cs 0 → 100644 +5 −0 Original line number Diff line number Diff line namespace Presenter { public interface IRoseSpawner { void SpawnRose(); } } No newline at end of file
Assets/Scripts/Presenter/IRoseSpawner.cs.meta 0 → 100644 +3 −0 Original line number Diff line number Diff line fileFormatVersion: 2 guid: 24fa8325e763470c8e412f76eeb46b59 timeCreated: 1713197911 No newline at end of file