22 lines
808 B
C++
22 lines
808 B
C++
#include "visitor_generator.hpp"
|
|
#include "../objectids.hpp"
|
|
#include "mario_visitor.hpp"
|
|
#include "mushroom_visitor.hpp"
|
|
|
|
std::shared_ptr< SDLPP::Visitor >
|
|
getVisitor( const MarioBlock &block, SDLPP::Scene &scene, bool &quit,
|
|
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, scene, quit, coin_count, moving_objects));
|
|
break;
|
|
case MUSHROOM_ID:
|
|
result = std::static_pointer_cast<SDLPP::Visitor>(std::make_shared<MushroomVisitor>());
|
|
default:
|
|
break;
|
|
}
|
|
return result;
|
|
}
|