added factory, unit maiden easier

This commit is contained in:
ProgramSnail 2021-05-18 17:43:03 +03:00
parent 52024e4b06
commit 1c87c30dda
13 changed files with 230 additions and 69 deletions

View file

@ -10,15 +10,29 @@ namespace map {
private:
using Coord = std::pair<int32_t, int32_t>;
Coord pos;
Coord size;
CellType cellType;
public:
UnitObj() {}
UnitObj(const Coord& pos, const Coord& size,
const CellType& cellType, map::GameMap* map) :
pos(pos), size(size), cellType(cellType) {}
void updateAll() {
Coord size;
GameMap* gameMap;
Cell cellPrototype;
Coord getEndPos() {
return {pos.first + size.first,
pos.second + size.second};
}
public:
UnitObj() = default;
UnitObj(const Coord& pos, const Coord& size,
const CellType& cellType,
const CellPlayer& cellPlayer, GameMap* gameMap) :
pos(pos), size(size), gameMap(gameMap),
cellPrototype(cellType, cellPlayer) {}
void resize(Coord newSize);
void move(Coord newPos);
void setPlayer(int player);
void setCellType(int cellType);
};
}