Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- [CreateAssetMenu]
- public class Product : ScriptableObject
- {
- [SerializeField] string _name;
- [SerializeField] int _price;
- [SerializeField] Sprite _icon;
- // куплен или нет
- public bool Bougth
- {
- get { return PlayerPrefs.GetInt ($"{name} bougth") == 1; }
- set { PlayerPrefs.SetInt ($"{name} bougth", value ? 1 : 0); }
- }
- public string Name => _name;
- public Sprite Icon => _icon;
- public int Price => _price;
- public bool TryBuy (int money)
- {
- Bougth = (money - _price >= 0);
- return Bougth;
- }
- }
Add Comment
Please, Sign In to add comment