Roulette/Assets/Scripts/Chip.cs
2023-02-28 22:23:01 +05:30

27 lines
518 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Chip : MonoBehaviour
{
public float value;
void Awake(){
RouletteManager.OnMoneyAvailablChanged.AddListener(OnMoneyChanged);
}
void OnMoneyChanged(float newMoney){
gameObject.SetActive(newMoney >= value);
}
void OnValidate(){
if(value == 0){
try{
value = float.Parse(gameObject.name.Replace("chip_",""));
}catch{}
}
}
}