#include #include "CollisionContext.h" #include "Museum.h" #include "NaiveCollisionChecker.h" #include "NullCollisionChecker.h" #include "QuadTreeCollisionChecker.h" using namespace std; CollisionContext::CollisionContext(Museum & m) : museum(m) {} shared_ptr CollisionContext::get_checker() { return this->checker; } shared_ptr CollisionContext::create_checker() { switch(this->checker_index) { case 0: return make_shared(this->museum); case 1: return make_shared(this->museum); case 2: return make_shared(this->museum); } this->checker_index = 0; return this->create_checker(); } void CollisionContext::update() { for (Artist * artist : this->museum.people.get_artists()) artist->colliding = false; this->checker = this->create_checker(); this->checker->check(); } void CollisionContext::cycle_method() { this->checker_index++; }