#include #include using namespace Ubpa; using namespace Ubpa::UECS; using namespace std; struct A {}; struct B {}; struct C {}; struct MySystem { static void OnUpdate(Schedule& schedule) { schedule.RegisterEntityJob( [](World* w, Entity e, const A* a, const B* b, CommandBufferPtr cb) { cb->AddCommand( [e, w]() { if (!w->entityMngr.Have(e, TypeID_of)) { cout << "Attach C" << endl; w->entityMngr.Attach(e, TypeIDs_of); } } ); }, "AB" ); schedule.RegisterEntityJob( [](World* w, Entity e, const A* a, const B* b, const C* c, CommandBufferPtr cb) { cb->AddCommand( [e, w]() { if (w->entityMngr.Have(e, TypeID_of)) { cout << "Dettach C" << endl; w->entityMngr.Detach(e, TypeIDs_of); } } ); }, "ABC" ); } }; int main() { World w; w.entityMngr.cmptTraits.Register(); w.systemMngr.RegisterAndActivate(); w.entityMngr.Create(Ubpa::TypeIDs_of); w.Update(); w.Update(); w.Update(); cout << w.DumpUpdateJobGraph() << endl; return 0; }