Add initial game systems and input handling for player interactions
This commit is contained in:
26
Assets/Scripts/Core/Systems/ScoreSystem.cs
Normal file
26
Assets/Scripts/Core/Systems/ScoreSystem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace Core.Systems
|
||||
{
|
||||
public class ScoreSystem : IDisposable
|
||||
{
|
||||
private int _currentScore;
|
||||
|
||||
public ScoreSystem()
|
||||
{
|
||||
_currentScore = 0;
|
||||
GameEvents.PresentCaught += OnPresentCaught;
|
||||
}
|
||||
|
||||
private void OnPresentCaught(int value)
|
||||
{
|
||||
_currentScore += value;
|
||||
GameEvents.ReportScoreUpdated(_currentScore);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GameEvents.PresentCaught -= OnPresentCaught;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user