Need assistance with SubType in custom class (UnityScript or C#)

I have set up a simple item class that holds all the basic information of every item in my game(Name, Prefab path, Icon, Type, etc.) and I’m trying to work in subtypes. Currently the Type is a short enum {weapon, armor, material, item, misc}.

What I want to have is something in the class script that says "if Type.weapon, SubType enum {oneHandMelee, twoHandMelee, shield, oneHandRanged, etc.}, else if Type.armor, SubType enum {helm, cuirass, greaves, etc}.

I understand the basics, just finished my first semester of college Scripting in Unity, I’m just not sure doing this is as simple as I think it should be. Any assistance from Coding veterans would be greatly appreciated.

If you’re talking about something like nested enums, this is not something you can do in C#. What you can do, however, is make a class for each of your enum entries (weapon, armor, etc), and make them inherit from the same class.

Instead of worrying too much about nest enums, why not make several distinct classes with different set of properties including type or socket type. Then you could make classes like Armor, Weapon, MiscItem, MagicItem, Potion etc.

What i’m trying to tell you: keep it simple :slight_smile: