Each enemy in my game is a Scriptable Object (Enemy1, Enemy2, etc). Each enemy also has its own unique script to determine how battles go (BattleEvent1, BattleEvent2, etc)
The way my logic currently works is:
BattleSystem
component has allBattleEvent
s attached to it.- When battle starts, check the
name
of the currentEnemy
, and use that string reference to pick whichBattleEvent
to run (LOTS of if statements).
But this is bad because it's all string references, so I can't easily ensure that each enemy has a BattleEvent
, and there's a lot of if/else statements.
What I wanted to do was attach each BattleEvent
script to its respective Enemy
Scriptable Object.
But I'm not able to drag the scripts in that Battle Event SerializeField there.
I would ideally like my logic to work like:
BattleSystem
loads the enemy, and just checks theEnemy.BattleEvent
to load the proper script.
Since I can't attach scripts to the SOs, I can't get this to work. Is there any way I can achieve a logic flow like this?