Is there a way to do this:
EDIT: I changed the code below
enum ItemType {
Resource = 0,
Weapon = 1,
Medical = 2,
Building = 3
}
enum MedicalType {
Heal = 0,
Feed = 1,
Drink = 2,
Multiple = 3
}
class item {
var Name : String;
var Type : ItemType = ItemType.Resource;
var texture : Texture2D;
if (Type == ItemType.Building) {
var Building : GameObject;
}
if (Type == ItemType.Medical) {
var MedType : MedicalType = MedicalType.Heal;
var MedicalAmount : int;
}
if (Type == ItemType.Weapon) {
var Weapon : GameObject;
var AmmoType : String;
var Range : float;
}
}