Implement Bombs
This commit is contained in:
30
Assets/Scripts/Presenter/ScorePresenter.cs
Normal file
30
Assets/Scripts/Presenter/ScorePresenter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using Services.Interfaces;
|
||||
using VContainer.Unity;
|
||||
using Views;
|
||||
|
||||
namespace Presenter {
|
||||
public class ScorePresenter : IDisposable{
|
||||
private IScoreService scoreService;
|
||||
private ScoreView scoreView;
|
||||
public ScorePresenter(IScoreService scoreService, ScoreView scoreView) {
|
||||
this.scoreService = scoreService;
|
||||
this.scoreView = scoreView;
|
||||
|
||||
this.scoreService.OnScoreChanged += OnScoreChanged;
|
||||
this.scoreView.SetScore(this.scoreService.Score);
|
||||
}
|
||||
|
||||
public void Tick() {
|
||||
this.scoreView.UpdateScore();
|
||||
}
|
||||
|
||||
private void OnScoreChanged(int score) {
|
||||
this.scoreView.SetScore(score);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
this.scoreService.OnScoreChanged -= OnScoreChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user