장보기 프로젝트
This commit is contained in:
46
Assets/02_Scripts/Item/ItemData.cs
Normal file
46
Assets/02_Scripts/Item/ItemData.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace VRShopping.Items
|
||||
{
|
||||
[CreateAssetMenu(fileName = "ItemData", menuName = "VR Shopping/Item Data", order = 0)]
|
||||
public class ItemData : ScriptableObject
|
||||
{
|
||||
[Header("Identity")]
|
||||
[SerializeField] private string _itemId;
|
||||
[SerializeField] private string _displayName;
|
||||
[SerializeField] private string _brand;
|
||||
[SerializeField] private ItemCategory _category;
|
||||
|
||||
[Header("Pricing")]
|
||||
[SerializeField, Min(0)] private int _basePrice;
|
||||
[SerializeField, Range(0f, 1f)] private float _discountRate;
|
||||
|
||||
[Header("Visuals")]
|
||||
[SerializeField] private Sprite _icon;
|
||||
[SerializeField] private GameObject _prefab;
|
||||
|
||||
public string ItemId => _itemId;
|
||||
public string DisplayName => _displayName;
|
||||
public string Brand => _brand;
|
||||
public ItemCategory Category => _category;
|
||||
public int BasePrice => _basePrice;
|
||||
public float DiscountRate => _discountRate;
|
||||
public Sprite Icon => _icon;
|
||||
public GameObject Prefab => _prefab;
|
||||
|
||||
public int FinalPrice => Mathf.RoundToInt(_basePrice * (1f - _discountRate));
|
||||
}
|
||||
|
||||
public enum ItemCategory
|
||||
{
|
||||
Fruit,
|
||||
Vegetable,
|
||||
Dairy,
|
||||
Bakery,
|
||||
Meat,
|
||||
Drink,
|
||||
Snack,
|
||||
Household,
|
||||
Etc
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user