2021-08-04 22:32:17 +00:00
|
|
|
#include "visitor_generator.hpp"
|
|
|
|
#include "../objectids.hpp"
|
|
|
|
#include "mario_visitor.hpp"
|
2021-08-07 19:42:51 +00:00
|
|
|
#include "mushroom_visitor.hpp"
|
2021-08-08 19:45:05 +00:00
|
|
|
#include "goomba_visitor.hpp"
|
2021-08-04 22:32:17 +00:00
|
|
|
|
2021-10-18 08:10:43 +00:00
|
|
|
std::shared_ptr<SDLPP::Visitor>
|
2022-09-22 18:16:46 +00:00
|
|
|
getVisitor(const MarioBlock &block, SDLPP::Scene &scene, bool &death,
|
2021-10-18 08:10:43 +00:00
|
|
|
int &coin_count,
|
|
|
|
std::vector<std::shared_ptr<MarioBlock>> &moving_objects) {
|
|
|
|
std::shared_ptr<SDLPP::Visitor> result{};
|
|
|
|
switch (block.getId()) {
|
|
|
|
case MARIO_ID:
|
|
|
|
result = std::static_pointer_cast<SDLPP::Visitor>(
|
|
|
|
std::make_shared<MarioVisitor>(block.getMovement().getY() < 0,
|
2022-09-22 18:16:46 +00:00
|
|
|
scene, death, coin_count,
|
2021-10-18 08:10:43 +00:00
|
|
|
moving_objects));
|
|
|
|
break;
|
|
|
|
case MUSHROOM_ID:
|
|
|
|
result = std::static_pointer_cast<SDLPP::Visitor>(
|
|
|
|
std::make_shared<MushroomVisitor>());
|
|
|
|
break;
|
|
|
|
case GOOMBA_ID:
|
|
|
|
result = std::static_pointer_cast<SDLPP::Visitor>(
|
|
|
|
std::make_shared<GoombaVisitor>());
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2021-08-04 22:32:17 +00:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|