I'm attempting to create a turn based battle system in Unity that is made up of dynamic events. Attacks may involve a lot of movement, animation, and often player input during the attack. The current idea is to have these "events" encompass the player's decision phase, actual attacks, in-battle cutscenes, and so on. I would like the order of these to be completely flexible as well to allow for modifying turn orders if needed and inserting cutscenes into the flow of the battle.
My current solution is made up of instantiated BattleEvent classes, with the current active BattleEvent being updated every frame in the battle manager. The battle manger can also change to a new event as needed.
Here's the bare bones of the event class:
public abstract class BattleEvent
protected BattleManager _battle;
public bool isCompleted = false;
public BattleEvent(BattleManager battleManager)
_battle = battleManager;
public abstract void UpdateEvent();
public abstract void StartEvent();
public abstract void EndEvent();
However, I'm still unsure of the best way to manage queuing up events, ordering them, and maybe splitting up events into smaller parts, such as if an attack has the player move to a position first, it would be nice to have a reusable "sub" event that can handle that part.
Currently I am considering just adding a queue to the battle manager that allows me to order up events and insert them where they might be needed. Events themselves would handle queuing up the next event. I could also add a queue of sub events to the events themselves, but I am unsure if this is a bad idea for reasons I might not be aware of. I guess my question is, what is the most logical way to be structuring this for scalability, or am I headed in the wrong direction entirely?