I’m just looking for a general idea of how to set it up in unity and if I should use scriptable objects or not
How would I go about cleanly having all item data in a script together with all the weapon data?
This is the flow chart of how I would do it right now with current knowledge
(Weapon Script) Weapon raw damage and effect ----> (Calculation script) Adds multipliers and effect ----> (Weapon Script) Executes attack with newly calculated effects and damage
How would I go about calculating multipliers based on equipped items without using a lot of if statements
Item1 2% dmg (equipped)
item2 4% dmg
item3 7% dmg (equipped)
Can this be done without doing this
if (item1Equipped == true)
{
damageMultiplier = damageMultiplier + item1.damageMultiplier
}
if (Item2Equipped == true)
{
[...]
}
I’m sure there is a way smarter, more elegant, and modular solution. I just don’t know what it is, maybe something with a foreach and an array of equipped items or something
Kind of in the same vein as the last question but how would I avoid lots of if statements, when for example the damage type changes and the code need to use a different damage multiplier
if (fireDamageType == true)
{
swordAttack.finalDamage = swordAttack.damage * fireDamageMultiplier
}
else if (sharpDamageType == true)
{
swordAttack.finalDamage = swordAttack.damage * sharpDamageMultiplier
}
//Etc
Any advice would be greatly appreciated