Inheritance, spawning, and scalable code

Hey All, I’m working on some rpg elements to get some practice and have some logic flow that I’m not sure will scale well given what I want to do in the future, and I’m hoping someone can help me think through what makes sense.

Current System
__*__Context: Only one “enemy entity” can exist at a time. So the player must “defeat” the current entity for the next entity to spawn.

  • I have different “entity types” that can spawn and engage the player, and these types are defined by some inheritance logic with scriptable objects.

  • Parent Scriptable Object class, Entity: defines ID, and Name

  • Enemy, inherits from Entity class: defines Sprite, Health, Damage

  • e.g., Slime Enemy that player can fight

  • Resource, Inherits from Entity class: defines Sprite, Durability

  • e.g., Iron Ore that player can mine for resources

  • The Entity data is then passed to an Entity Prefab which will set the Entity Prefab attributes = to the passed Entity stats from the inheritance structure.

  • E.g., Entity Prefab sprite = Enemy.sprite

  • Enemy Prefab then gets instantiated by a Spawner class

Challenge
I want the player to choose a desired skill to train [Combat, Mining, etc.] and the spawner filters the list of possible entity spawns to only those who are attributed to the appropriate skills. I.e., Selecting ‘Mining’ will only cause ore and rocks to spawn, while selecting ‘Combat’ will only spawn enemies like goblins, dragons, etc, but not rocks and ore.

Right now, my thought is to define multiple lists of scriptable object data based on their type. So if player chooses skill = combat, the spawner only gets fed the list of scriptable objects who are defined as “Enemy” and requires the skill = combat, while is skill = mining the spawner gets fed a different list of SOs who are defined as “resources” and require the skill of ‘Mining’ in order to be engaged with.

Question / Confusion
In my brain, I feel it’d be easier to have one master list that contains all possible entities and their attributes instead of this inheritance structure so the spawner only needs to filter through one list.

When trying to mess with a one list setup, with the inheritance structure I run into the challenge of making a list of all type = Entity, but can only reference their ID and Name and not Health if its an Enemy or its Durability if its a Resource.

Could someone please point me in the direction of what makes sense if I want to scale this to many skills in the future? (e.g., Fishing, Cooking, etc.)

Summary; An inheritance structure for entity types seems to propose challenges when trying to pass lists of possible entity spawns to a spawner, as a master list of type = Entity can only reference ID and Name where I also need the additional fields unique to an inherited Enemy type [health, damage] or an inherited resource [durability] type.

I think a multi-list setup makes more sense, from reading your post.
After all, you’re not going to scale it to thousands of skills, just a handful (a couple dozen at most, probably)

But then i don’t know much about this sort of thing so it’s entirely possible there is a solution, i just can’t picture it.

That’s the way I see it as well, but I’m still new to C# and unity so there may be a more efficient solution I’m just not aware of