Foerming/Assets/Scripts/Item.cs
d-hain 3a564aa909 edge colliders on camera
animals are moving now (very bad => will get better)
set BasicTile Collider2D isTrigger to false
2022-06-10 17:51:46 +02:00

30 lines
775 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;
private int _id = -1;
public Sprite selectedSprite;
public Sprite defaultSprite;
public int price;
public int SellPrice => Convert.ToInt32(price * 0.8);
public int ID => _id;
public Item(string displayName, string description, int id) {
this.displayName = displayName;
this.description = description;
_id = id;
}
public int CompareTo(Item other) {
return this._id - other._id;
}
public void SetID(int id) {
if (_id != -1) {
_id = id;
}
}
}