I’m making a battle system involving decks of cards that contain 1 - 4 actions. I’m currently planning to create these cards as prefabs that I can drag actions into to populate. The actions are defined using the following base/derived class scripts:
(Base Class)
public abstract class Abillity : ScriptableObject
{
public string move_name; //name of move
public string desc; //short description of move
public int base_power;
public abstract IEnumerator DoAbility();
}
(Example derived class)
public class Swipe : Abillity
{
public void setup()
{
move_name = "Swipe";
desc = "A slash using a light weapon or claws";
base_power = 45;
}
public override IEnumerator DoAbility()
{
// this will contain specific instructions executed when using this action
}
}
Found this code from this thread: Best Way To Handle Multiple Moves (Like Pokemon)? - Questions & Answers - Unity Discussions
Here is the scriptable object I’m using for the card prefab:
public class Card_Prefab : ScriptableObject
{
public string card_description;
public List<Abillity> actions = new List<Abillity>();
}
This is how the hierarchy looks when the prefab is generated:
I am unable to drag the script for “swipe” into Element 0. I’m sure it’s something I’ve misunderstood since I’m relatively new to unity, but is this approach possible? If not, is there an alternate approach to this that I can try?
Thanks