extended usable Items with UsableItem
This commit is contained in:
parent
fb9aa4e349
commit
0d49c92c15
8 changed files with 21 additions and 26 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue