feat: implement shapes for entities

This commit is contained in:
2021-11-21 20:00:35 +01:00
parent a716e46c64
commit 070749e685
11 changed files with 92 additions and 70 deletions

View File

@@ -2,6 +2,8 @@
#include "Types.h"
#include "misc/Shapes.h"
#include <vector>
#include <memory>
#include <cmath>
@@ -17,14 +19,33 @@ enum class TeamColor : std::int8_t {
Blue
};
struct Spawn {
Direction direction;
std::int32_t x, y;
class Spawn : public utils::shape::Rectangle {
private:
Direction m_Direction;
public:
Spawn(){
setWidth(5);
setHeight(5);
}
Direction getDirection() const { return m_Direction; }
void setDirection(Direction direction) { m_Direction = direction; }
};
struct TeamCastle {
std::int32_t x, y;
std::uint16_t life = 1000;
struct TeamCastle : public utils::shape::Rectangle{
private:
float m_Life;
public:
TeamCastle() : m_Life(1000) {
setWidth(5);
setHeight(5);
}
float getLife() const { return m_Life; }
void setLife(float life) { m_Life = life; }
void damage(float damage) { m_Life = std::max(0.0f, m_Life - damage); }
};
class Team {