extended usable Items with UsableItem

This commit is contained in:
dhain 2022-05-10 00:01:57 +02:00
parent fb9aa4e349
commit 0d49c92c15
8 changed files with 21 additions and 26 deletions

View file

@ -1,17 +1,22 @@
using System;
using UnityEngine;
public class Item : MonoBehaviour {
private string displayName;
private string description;
private int id; //TODO: create an actual ID System that makes snens
public class Item : MonoBehaviour, IComparable<Item> {
private readonly string displayName;
private readonly string description;
private readonly int id; //TODO: create an actual ID System that makes snens
public SpriteRenderer spriteRenderer;
public Sprite selectedSprite;
public Sprite defaultSprite;
public Item(string displayName, string description, int id) {
this.displayName = displayName;
this.description = description;
this.id = id;
spriteRenderer.sprite ??= defaultSprite; // defaultSprite is set in UnityEditor
}
public int CompareTo(Item other) {
return this.id - other.id;
}
}