|
|
|
@ -19,7 +19,7 @@ sf::Color Cell::color() const noexcept
|
|
|
|
|
return cell_color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cell::setHeight(coordinate shift_by_y)
|
|
|
|
|
void Cell::setHeightShift(coordinate shift_by_y)
|
|
|
|
|
{
|
|
|
|
|
height_shift = shift_by_y;
|
|
|
|
|
}
|
|
|
|
@ -46,6 +46,11 @@ bool PassableCell::onMovingTo(HeroPtr &hero, LevelPtr &level)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CellPtr PassableCell::getDefaultInstance() const
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<PassableCell>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
WaterCell::WaterCell(coordinate cell_row, coordinate cell_col, const sf::Color &color) :
|
|
|
|
@ -64,12 +69,19 @@ bool WaterCell::onMovingTo(HeroPtr &hero, LevelPtr &level)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CellPtr WaterCell::getDefaultInstance() const
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<WaterCell>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
WallCell::WallCell(coordinate cell_row, coordinate cell_col, const sf::Color &color) :
|
|
|
|
|
Cell(cell_row, cell_col, color),
|
|
|
|
|
height_shift(10) // walls are a bit higher than ground and water
|
|
|
|
|
{}
|
|
|
|
|
Cell(cell_row, cell_col, color)
|
|
|
|
|
{
|
|
|
|
|
// walls are a bit higher than ground and water
|
|
|
|
|
height_shift = 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WallCell::~WallCell()
|
|
|
|
|
{}
|
|
|
|
@ -82,13 +94,19 @@ bool WallCell::onMovingTo(HeroPtr &hero, LevelPtr &level)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CellPtr WallCell::getDefaultInstance() const
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<WallCell>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
ChargeCell::ChargeCell(coordinate cell_row, coordinate cell_col, int has_charges, const sf::Color &color) :
|
|
|
|
|
Cell(cell_row, cell_col, color),
|
|
|
|
|
cell_charges(has_charges),
|
|
|
|
|
height_shift(5) // charges are a bit higher than ground and water, but lower than walls
|
|
|
|
|
{}
|
|
|
|
|
cell_charges(has_charges)
|
|
|
|
|
{
|
|
|
|
|
height_shift = 5; // charges are a bit higher than ground and water, but lower than walls
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ChargeCell::~ChargeCell()
|
|
|
|
|
{}
|
|
|
|
@ -102,6 +120,11 @@ bool ChargeCell::onMovingTo(HeroPtr &hero, LevelPtr &level)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CellPtr ChargeCell::getDefaultInstance() const
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<ChargeCell>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
ExitCell::ExitCell(coordinate cell_row, coordinate cell_col, const sf::Color &color) :
|
|
|
|
@ -120,6 +143,11 @@ bool ExitCell::onMovingTo(HeroPtr &hero, LevelPtr &level)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CellPtr ExitCell::getDefaultInstance() const
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<ExitCell>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
TeleportCell::TeleportCell(coordinate cell_row, coordinate cell_col, coordinate new_cell_row, coordinate new_cell_col, const sf::Color &color) :
|
|
|
|
@ -146,13 +174,21 @@ void TeleportCell::setDestination(coordinate new_cell_row, coordinate new_cell_c
|
|
|
|
|
new_col = new_cell_col;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CellPtr TeleportCell::getDefaultInstance() const
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<TeleportCell>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
TriggerCell::TriggerCell(/*std::vector<CellPtr> &&cells_to_change,*/ coordinate cell_row, coordinate cell_col, const sf::Color &color) :
|
|
|
|
|
Cell(cell_row, cell_col, color),
|
|
|
|
|
height_shift(5) // triggers are a bit higher than ground and water, but lower than walls
|
|
|
|
|
Cell(cell_row, cell_col, color)
|
|
|
|
|
{
|
|
|
|
|
//cells = std::move(cells_to_change);
|
|
|
|
|
|
|
|
|
|
// triggers are a bit higher than ground and water, but lower than walls
|
|
|
|
|
height_shift = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TriggerCell::~TriggerCell()
|
|
|
|
@ -177,3 +213,8 @@ bool TriggerCell::onMovingTo(HeroPtr &hero, LevelPtr &level)
|
|
|
|
|
// It's an impassable object, so player can't move to here.
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CellPtr TriggerCell::getDefaultInstance() const
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<TriggerCell>();
|
|
|
|
|
}
|
|
|
|
|