25 lines
495 B
C++
25 lines
495 B
C++
#include "ai_world.hpp"
|
|
|
|
#include <motor/basic/body.hpp>
|
|
#include "physics.hpp"
|
|
#include <motor/basic/scene.hpp>
|
|
|
|
|
|
namespace motor {
|
|
void AIWorld::update(float dt, Input& input, World& world){
|
|
auto bodies_copy = bodies;
|
|
for(auto& b : bodies_copy){
|
|
if(b->ai){
|
|
b->ai->update(dt, {*b, input, world});
|
|
}
|
|
}
|
|
}
|
|
|
|
void AIWorld::add(std::shared_ptr<Body> b){
|
|
astrant::append(bodies, {b});
|
|
}
|
|
|
|
void AIWorld::remove(std::shared_ptr<Body> b){
|
|
astrant::remove_element(bodies, b);
|
|
}
|
|
}
|