InverNessian / SafeguardsOfLeyto

For development of my game by the same name.
1 stars 0 forks source link

Weapons, Items, Talents #4

Closed InverNessian closed 5 years ago

InverNessian commented 5 years ago

Units need to be able to equip Weapons and Items. This will involve a List of Scriptable Objects to hold the weapon data? Or perhaps a Dictionary? Either way, it relies on the data persistence issue first and foremost, as there's no way I can enter all these weapons by hand.

Talents will work in much the same way.

Both could maybe use a script to dynamically instantiate Scriptable Objects by reading in data from csv files? They would be stored in a List, maybe? But don't serialize them, since they're just generated.

Also, need to make events I think, it's the easiest way to have trigger-based abilities go off.

InverNessian commented 5 years ago

Now that a lot of other things have been implemented, this will be my next priority. I need to figure out how to manage talents and items.

InverNessian commented 5 years ago

Okay. I have a way of doing this, and it's been really tough to get it going.

Basically, each Talent that has a 'trigger' will have a corresponding Trigger component that gets attached to the units' gameobject at runtime. The combat or move functions will then be able to call GetComponents to fetch a list of all talents.

TalentTriggers will have interface types that define common methods for that type. For example, ICombat defines a method for each combat step (AttackStep, OnHit, etc). This way, each TalentTrigger can implement the interfaces they need, and then implement only the methods they trigger on.

For example, Lifetaker would only need to put its functionality in OnHit and won't bother with AttackStep.

Since the methods per interface are all standardized, the CombatController (or CombatObject*) will then attach all those methods to a delegate in the CombatController. As long as they have the proper return type, we can either invoke the delegate (for void methods) or use the InvocationList (for methods that return values).

Currently, the struggle is whether to use an object-based Combat Controller or a static one. More discussion on that in the other issue.

InverNessian commented 5 years ago

For Weapons and Accessories, I was going to have them go back to being just a list on StatsData, but for any that have trigger effects they may need to be implemented like Talents. Hmm.

InverNessian commented 5 years ago

I've successfully created a framework to use with this. All listener methods are standardized void methods that take a "[action]Data" object as parameters. They'll modify the data object to execute their effect. This is tested and works.