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.
35 lines
838 B
C#
35 lines
838 B
C#
1 month ago
|
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()
|
||
|
{
|
||
|
EventManager.CoinIncreaser -= IncreaseCoin;
|
||
|
}
|
||
|
void IncreaseCoin()
|
||
|
{
|
||
|
coinText.text = PlayerPrefs.GetInt("Money").ToString();
|
||
|
}
|
||
|
}
|