- Home /
Creating a custom List or Collection
Trying to make an ambiguous Item class and instead of using inheritance for each item, I want each item to have a list of attributes that tell game (and player) how it can be used. The problem I'm facing is that there is a potential for multiple attributes of the same type on the item AND what if the attached attributes conflict with each other in terms of function.
Example: I add an attribute to the item that can allow it to be equipped as clothing. I don't want to accidentally add an attribute that allows it to be thrown like a tomahawk or something.
Granted, the problem is really only a hypothetical and can be avoided by being careful. Just want to save time in the long run.
Answer by ShadyProductions · Nov 08, 2019 at 10:28 PM
Make an item base class, and make other classes that inherit from the base
for example Item has all the basic stuff that every item has
make a clothing class that inherits from item, and axes class that inherits from item. Each implement their own implementation.
There's really no better way :)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How i can make a script-made button interactable? 0 Answers
How to make an inventory for my text advenutre? 0 Answers
stack by quanity...? C# 2 Answers
What's the name of this system? 0 Answers