#include "entity.h"
#include <game/manager.h>

namespace game
{

entity::entity(const vec2u &pos, const vec2u &size, level *root)
{
    _root = root;
    _pos = pos;
    _size = size;
    entityManager::add(this);
}
/*
entity::~entity()
{
    onCellDestroyed();
}*/

void entity::onCellDestroyed()
{
    for(cell *c: _cells)
        c->free();
    _cells.clear();

    entityManager::remove(this);
}

void entity::_placeOnMap()
{
    _root->allocateCells(_cells, _pos, _size, this);
}

void entity::destroy()
{

}

}
