I've started developing a medium-sized XNA game some days ago and now that I have outlined the basic structure I was wondering which is the best way to implement new Items in my game.
The overall structure is clear:
Characters (such as Players and Enemies) have Inventories which is basically a 2d-Array of the abstract class Item.
Item has four virtual functions: Load, Unload, Update, Draw.
There are three derivated abstract classes from Item: Weapon, Armor and Potion.
Now every derivate of these classes overrides the virtual functions of Item to implement new features.
In my game-loop Update() is called for every loaded Item in the inventory.
What do you think of this solution? Of course it has much to do with personal preferences, but I want to know how others would do this.
I know interfaces or abstract functions also do the job.
Another question would be how Entities are stored in the game's main class. Is there one big array BasicEntity entities or are there many, many small ones like
Thank you very much, Phil.