I have a script called item that is a constructor and has an enum that allows you to choose the item type. I also have another script inheriting from Item called Weapon that has specific variables. Is there any way that I could make the variables for that class show up based on what you choose from the enum? Thank you beforehand for any help.
Here are my scripts:
using UnityEngine;
using System.Collections;
[System.Serializable]
public class Item
{
public int itemID;
public string itemName;
public string itemDescription;
public Sprite itemIcon;
public ItemType itemType;
public GameObject itemModel;
public int itemValue;
public int itemDurability;
public enum ItemType
{
Weapon,
Spell,
Consumable,
QuestItem,
WeaponPart,
Head,
Torso,
Hands,
Legs,
Feet,
None
}
}
And then there is Weapon which inherits from Item:
using UnityEngine;
using System.Collections;
public class Weapon : Item
{
public int weaponDamage;
}
It’s very simple for testing purposes.