This is my first time using inheritance to write an item system. For example, I have these two classes:
[System.Serializable]
public class Item {
public string name;
public int weight;
}
[System.Serializable]
public class Aid : Item {
public bool healPoison = false;
public int healingValue = 1;
}
Basic stuff, really. However, how do I put, say, a healing potion into the world as a pickup? Before, I had all possible item class variables under the item main class and then had a Mono class "ItemHolder" which had a single variable of Type Item, and I put this onto a GameObject and voila, the item is in the world and accessible. Now that I try to use inheritance, I don't see how this would be possible save for having seperate Item Holder Monos for every item subclass (AuidHolder, WeaponHolder...)
↧