using UnityEngine;
using UnityEngine.Events;

[System.Serializable()]
public class UnityEventScore : UnityEvent<int> { }

public class TracerScore : MonoBehaviour {

    public UnityEventScore onScoreUpdated = new UnityEventScore();

    private int currentScore = 0;
    public int CurrentScore {
        get { return currentScore; }
    }

    public void Awake() {
        // immediately notify listeners with initial score
        onScoreUpdated.Invoke(currentScore);
    }

    public void AddScore(int scoreToAdd) {
        currentScore += scoreToAdd;
        onScoreUpdated.Invoke(currentScore);
    }
}
