I’m converting an old OOP utility AI I made previously to ecs. My issue is that I can’t find a way to package the tasks properly. I have created task components (PursueTargetTask, FleeTargetTask, etc) but I want to add these to an entity to indicate that it CAN perform these tasks, this means that I also had to create an ActiveTask component to identify the current task but I can’t store IComponentData as a type in another component (to store a generic “task”) so i’ve had to resort to using an enum.
The problem with this is its messy and I have to manage my tasks as components and as enums then i have to create gross switch statement to manually execute systems based on the CurrentTask enum. all of these need to be kept in sync everytime i create a new task. This feels like it requires some sort of generics.
Is there an idiomatic ecs solution to this type of problem?