I am trying to create a spell casting system for an auto chess game.
I find myself not knowing which direction to go in my design. I started out with a Spell as a scriptable object that contains a list of spell effects (damage, heal, etc). Each effect can spawn a game object (usually some sort of particle effect) to indicate the cast.
This started to get a bit complicated and I began wondering if I am going about this the wrong way. The second attempt was an abstract spell class where I'd create concrete spells from it (lightning blast, fireball, for example). When the cast animation completes on the unit, it would call
spell.Cast() and the concrete class would take care of the rest. The downside is two fold:
- The unity editor doesn't seem to let me put a derived class in the "spell" slot since I said it would be of type
Spell(the abstract class).
- This will certainly result in a large number of classes... not sure this matters as the other way will give me lots of scriptable objects.
When I encounter this many issues with something like this, I start to wonder if I am designing something wrong. Am I missing a super easy way to do this?