feat: add working shapes

This commit is contained in:
2021-11-22 19:15:32 +01:00
parent 1d7a8cc66b
commit 7fb357e9c8
5 changed files with 42 additions and 27 deletions

View File

@@ -87,7 +87,7 @@ const TowerStats* getTowerStats(TowerType type, TowerLevel level);
typedef std::uint16_t TowerID;
class Tower : public utils::shape::Point {
class Tower : public utils::shape::Circle {
private:
TowerID m_ID;
TowerType m_Type;
@@ -96,9 +96,9 @@ private:
protected:
utils::CooldownTimer m_Timer;
public:
Tower(TowerID id, TowerType type, std::int32_t x, std::int32_t y, PlayerID builder) : utils::shape::Point(x, y), m_ID(id), m_Type(type), m_Builder(builder),
Tower(TowerID id, TowerType type, std::int32_t x, std::int32_t y, PlayerID builder) : utils::shape::Circle(x + 0.5f, y + 0.5f, 0), m_ID(id), m_Type(type), m_Builder(builder),
m_Timer(getStats()->getDamageRate() * 1000) { // converting seconds to millis
setRadius(getStats()->getRange());
}
virtual TowerType getType() const = 0;
@@ -110,6 +110,7 @@ public:
m_Level.setPath(path);
m_Timer.setCooldown(getStats()->getDamageRate() * 1000); // converting seconds to millis
m_Timer.reset();
setRadius(getStats()->getRange());
}
std::uint16_t getID() const { return m_ID; }