0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 12:33:43 +00:00
SDL_Minigame/src/Entity.cpp

48 lines
753 B
C++

#include "Entity.h"
#include "Manager.h"
#include "Component.h"
#include <cstddef>
void Entity::update() const
{
for (auto const& c : components) c->update();
}
void Entity::draw() const
{
for (auto const& c : components) c->draw();
}
bool Entity::hasGroup(Group mGroup)
{
return groupBitSet[mGroup];
}
void Entity::addGroup(Group mGroup)
{
groupBitSet[mGroup] = true;
manager.addToGroup(this, mGroup);
}
void Entity::delGroup(Group mGroup)
{
groupBitSet[mGroup] = false;
}
std::bitset<MAX_GROUPS> Entity::getGroupBitSet()
{
return groupBitSet;
}
void Entity::setTeam(Entity::TeamLabel teamLabel)
{
this->teamLabel = teamLabel;
manager.addToTeam(this, (size_t) teamLabel);
}
Entity::TeamLabel Entity::getTeam()
{
return teamLabel;
}