#include "ai_executor.h" #include "systems/ai_system/ai_behavior.h" #include "systems/ai_system/ai_behavior_registry.h" #include "systems/ai_system/ai_types.h" #include namespace Game::Systems::AI { void AIExecutor::run(const AISnapshot &snapshot, AIContext &context, float delta_time, AIBehaviorRegistry ®istry, std::vector &out_commands) { bool exclusive_behavior_executed = false; registry.for_each([&](AIBehavior &behavior) { if (exclusive_behavior_executed && !behavior.can_run_concurrently()) { return; } bool const should_exec = behavior.should_execute(snapshot, context); if (should_exec) { size_t commands_before = out_commands.size(); behavior.execute(snapshot, context, delta_time, out_commands); size_t commands_after = out_commands.size(); context.debug_info.total_commands_issued += static_cast(commands_after - commands_before); if (!behavior.can_run_concurrently()) { exclusive_behavior_executed = true; } } }); } } // namespace Game::Systems::AI