using System; using UnityEngine; using UnityEngine.Serialization; namespace VRShopping.Player { public class PlayerWallet : MonoBehaviour { // 예산 (Inspector에서 초기값 설정) [SerializeField, Min(0), FormerlySerializedAs("Budget")] private int _budget; // UI 갱신용 이벤트 public event Action OnBudgetChanged; public int Budget => _budget; private void Start() { OnBudgetChanged?.Invoke(_budget); } public bool PayMoney(int cost) { //예산이 비용보다 많을시 if (_budget >= cost) { _budget -= cost; OnBudgetChanged?.Invoke(_budget); return true; } //예산 부족 return false; } } }