using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ScoreKeeper : MonoBehaviour
{
    public static ScoreKeeper instance;
    public int score { get; private set; } = 0;

    private void Awake()
    {
        instance = this;
    }

    private void Start()
    {
        GameEvents.instance.onGameRestartEvent += ResetScore;
    }

    private void Update()
    {
        GetComponent<Text>().text = "Score: " + score;
    }

    public void IncrementScore(int score)
    {
        this.score += score;
    }

    public void ResetScore()
    {
        this.score = 0;
    }
}
