Jacob-Brosler / TRPG

A TRPG/RPG hybrid, this game combines the massive, open, living and breathing overworld of a traditional RPG with the battle system of a tactical RPG
0 stars 0 forks source link

Assets/Script/Inventory #3

Open EthanNichols opened 4 years ago

EthanNichols commented 4 years ago

Thoughts

Sorta difficult to review this much code. Mainly because there many more classes being referenced that would just unfold out into a huge system to learn. So while there are still things that I could suggest improving I decided to save myself from opening Pandora's box.

Formatting / Grammer

Don't really have a good understanding with what your comment formatting is. Seems like: //comment No space after //, Start with a lower case letter, No periods /// CommentSpace after ///, Start with upper case letter per line, Some assisting punctuation, Comment params and return values Just make sure comments follow whatever your formatting scheme is. Might help creating a formatting wiki on this project's wiki.

Suggestion(s):

Questionable:

I would keep 1 class per file. Reduces confusion when you're looking at Inventory.cs, but looking at the StoredItem class.

I also like to keep Enums to their own file. But that's a personal preference.

Jacob-Brosler commented 4 years ago

Fixed most of the issues, here's the reasoning for what wasn't fixed: ItemTypeDefinitions.cs:62 - Due to the nature of this value denoting different things depending on this being a weapon or armor there's no real way to have a cohesive enum make sense.

Inventory.cs:40 - Unsure of how that would help

Inventory.cs:165-207 - Pure debug, no reason to migrate from strings as it will be removed when I'm done testing inventory.

Inventory.cs:243 and Inventory.cs:384 - I could be wrong but even with a copy constructor I'd still need to cast to equippable for it to copy correctly, leading to no real change in complexity. I did add copy constructors to make it so if I change either of the classes later it's less searching to change the copier.

Inventory.cs:322 - I'd rather anything editing the static list be in the inventory class if it can be helped, also consolidates addition for later in case more functionality needs to be put there.

I'll leave this open for now, if you disagree with any of this please let me know.

EthanNichols commented 4 years ago

ItemTypeDefinitions.cs:62 I would suggest trying to make sure the variable only represents one thing. Rather than an assortment of different things. Up to you though.

Inventory.cs:40 There was a "CompareTo" function which appears to have been removed.

Inventory.cs:322 If you only want to add/remove/edit the list in the inventory class then there is an inherit problem with having the list be static. If you don't want someone to open a door, don't put a doorknob on it.

Inventory.cs:384 Yes you'd still have to cast it. But it's more scalable for the future using a copy constructor. Unless there is only some specific data that you'd like copied instead of the entire class.