rabidus-test/Assets/Scripts/CoinCounter.cs

20 lines
400 B
C#
Raw Normal View History

2023-07-24 16:38:13 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class CoinCounter : MonoBehaviour
{
[SerializeField]
private int _coinCount;
public event UnityAction<int> OnValueChanged;
public int CoinCount => _coinCount;
public void CollectCoin()
{
_coinCount++;
OnValueChanged?.Invoke(_coinCount);
}
}