You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Coiner.cs

36 lines
878 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Coiner : MonoBehaviour
{
public delegate void EventHandler();
public static event EventHandler Increaser;
public TextMeshProUGUI coinText;
private void Start()
{
IncreaseCoin();
//EventManager.CoinIncreaser += IncreaseCoin;
}
void OnEnable()
{
IncreaseCoin();
EventManager.CoinIncreaser += IncreaseCoin;
Debug.Log("OnEnabler Caller");
}
private void OnDisable()
{
IncreaseCoin();
EventManager.CoinIncreaser -= IncreaseCoin;
}
private void OnApplicationQuit()
{
Debug.Log("OnApplicationQuit");
EventManager.CoinIncreaser -= IncreaseCoin;
}
void IncreaseCoin()
{
coinText.text = PlayerPrefs.GetInt("Money").ToString();
}
}