Foerming/Assets/Scripts/Item.cs
d-hain ba9be3d96b you can now sell Items with Right Mouse Click on an InventorySlot for the Item.SellPrice
and it gets put into the Shop for full price

renamed Item.cost to Item.price
2022-06-08 22:52:28 +02:00

23 lines
705 B
C#

using System;
using UnityEngine;
[CreateAssetMenu(fileName = "New Item", menuName = "Inventory/Item")]
public class Item : ScriptableObject, IComparable<Item> {
public string displayName;
public string description;
public int id; //TODO: create an actual ID System that makes snens
public Sprite selectedSprite;
public Sprite defaultSprite;
public int price;
public int SellPrice => Convert.ToInt32(price * 0.8);
public Item(string displayName, string description, int id) {
this.displayName = displayName;
this.description = description;
this.id = id;
}
public int CompareTo(Item other) {
return this.id - other.id;
}
}