2021-01-10 18:15:58 +01:00
|
|
|
using System;
|
|
|
|
|
|
|
|
public static class Score
|
|
|
|
{
|
|
|
|
private static ulong _value;
|
2021-01-11 11:01:41 +01:00
|
|
|
public static ulong Value => _value;
|
|
|
|
|
|
|
|
public static void Add(ulong val)
|
|
|
|
{
|
|
|
|
_value += val;
|
|
|
|
ScoreChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Reset()
|
2021-01-10 18:15:58 +01:00
|
|
|
{
|
2021-01-11 11:01:41 +01:00
|
|
|
_value = 0;
|
|
|
|
ScoreChanged();
|
2021-01-10 18:15:58 +01:00
|
|
|
}
|
2021-01-11 11:01:41 +01:00
|
|
|
|
|
|
|
private static void ScoreChanged()
|
|
|
|
{
|
|
|
|
ScoreUpdated?.Invoke(_value);
|
|
|
|
}
|
|
|
|
|
2021-01-10 18:15:58 +01:00
|
|
|
public static event Action<ulong> ScoreUpdated;
|
|
|
|
}
|