ItemDataSO.cs 714 B

1234567891011121314151617181920212223242526
  1. using UnityEngine;
  2. using System.Collections.Generic;
  3. [CreateAssetMenu(fileName = "ItemDataSO", menuName = "Game/Item Data")]
  4. public class ItemDataSO : ScriptableObject
  5. {
  6. public int itemId;
  7. public string itemName;
  8. public string description;
  9. public int price;
  10. public ItemType itemType;
  11. public int value;
  12. public Sprite icon;
  13. public IItemEffect GetEffect()
  14. {
  15. return itemType switch
  16. {
  17. ItemType.HealthPotion => new HealthPotionEffect(value),
  18. ItemType.Shield => new ShieldEffect(value),
  19. ItemType.DoubleGold => new DoubleGoldEffect(value),
  20. ItemType.Hint => new HintEffect(),
  21. _ => null
  22. };
  23. }
  24. }