| 1234567891011121314151617181920212223242526 |
- using UnityEngine;
- using System.Collections.Generic;
- [CreateAssetMenu(fileName = "ItemDataSO", menuName = "Game/Item Data")]
- public class ItemDataSO : ScriptableObject
- {
- public int itemId;
- public string itemName;
- public string description;
- public int price;
- public ItemType itemType;
- public int value;
- public Sprite icon;
-
- public IItemEffect GetEffect()
- {
- return itemType switch
- {
- ItemType.HealthPotion => new HealthPotionEffect(value),
- ItemType.Shield => new ShieldEffect(value),
- ItemType.DoubleGold => new DoubleGoldEffect(value),
- ItemType.Hint => new HintEffect(),
- _ => null
- };
- }
- }
|