Scriptable Object - Ability System, Unique Spell Effect

Hello,

Here is a part of my Ability Class:

[CreateAssetMenu(fileName = "Ability", menuName = "Scriptable Object/Ability", order = 1)]
public class Ability : ScriptableObject
{
    public new string name;
    public Sprite icon;

    [TextArea(5, 5)]
    public string description;

    [Header("Requirements")]
    public int levelRequirement;
    public PlayerClasses classRequirement;

    [Header("Ability Information")]
    public School school;
    public ResourceTypes resourceType;
    public int resourceCost;

    [Header("Damage")]
    public int effectMin;
    public int effectMax;

My question
I’m using Scriptable Objects and generally curious on how I should handle Unique effects for my abilities.

Top of my head ideas
Should I create a new Class named for example “Fireball”, and let it inherit from Ability?

[CreateAssetMenu(fileName = "Fireball", menuName = "Scriptable Object/Ability/Fireball", order = 1)]
public class Fireball : Ability
{
}

This will create a lot of abilities in the Unity Create List. I have no idea if that is a issue, or a bad experience down the road.

Is there way to create a speific Class for “Fireball” with an Override OnUse(); and then add it to the Ability Class?
I don’t know. I might be overthinking this, but I see “issues” with every solution I can think of, and before I start I would like to hear your suggestions

Thanks.

I would still try to find common features between the unique effects, at least creating an abstract onEffect if nothing else. At some stage you will have to hardcode/decide what these effects are going to be, and keeping them in a seperate derived class seems the cleanest to me.

1 Like