Esempio n. 1
0
void ComponentManager<T>::reuseComponent(id entity)
{
    assert(deletedComponentsIndex.size() > 0 && "ComponentManager: no reusable components");
    entitiesComponentsIndex[entity] = deletedComponentsIndex.back();
    deletedComponentsIndex.pop_back();
    resetComponent(entity);
}
Esempio n. 2
0
void ComponentManager<T>::addComponent(id entity)
{
    if (hasComponent(entity)) {
        resetComponent(entity);
    } else {
        reserveComponentIndex(entity);
        deletedComponentsIndex.size() == 0 ? createComponent(entity) : reuseComponent(entity);
        fireEntityAddedSignal(entity);
    }
}
Esempio n. 3
0
 ComponentNode::~ComponentNode()
 {
     COCA_DEBUG_INFO( "~ComponentNode " << getName() << ":" << getComponentId() );
     resetComponent();
     COCA_DEBUG_INFO( "~ComponentNode end " << getName() << ":" << getComponentId() );
 }
Esempio n. 4
0
 ComponentNode::ComponentNode( const std::string& componentId, const std::string& name, INode* parent ) :
         ANode( name, parent ),
         _component( 0 )
 {
     resetComponent( componentId );
 }