//using UnityEngine; //// сярюпебьхи тсмйжхнмюк яеивюя бяе вепег ComWrapper. //public class PlayerWallet //{ // public static event System.Action OnCoinsChanged; // (playerId, newCoins) // private int playerId; // private string key; // public PlayerWallet(int playerId) // { // this.playerId = playerId; // key = $"Player{playerId}_Coins"; // } // public int GetCoins() => PlayerPrefs.GetInt(key, 0); // public void AddCoin() // { // int current = GetCoins(); // int newAmount = current + 1; // PlayerPrefs.SetInt(key, newAmount); // PlayerPrefs.Save(); // OnCoinsChanged?.Invoke(playerId, newAmount); // } // public bool SpendCoin() // { // int current = GetCoins(); // if (current >= 1) // { // PlayerPrefs.SetInt(key, current - 1); // PlayerPrefs.Save(); // OnCoinsChanged?.Invoke(playerId, current - 1); // return true; // } // return false; // } //}