Example #1
0
File: Area.cpp Project: dcbishop/tx
/**
 * Adds an Object to the area.
 * @param object The Object's pointer.
 * @see removeObject()
 */
void Area::addObject(Object* object) {
    //object->setArea(this);
    DEBUG_M("Entering function...");
    GameManager* gm = getGameManager();
    if(object->getGameManager() != gm) {
        DEBUG_A("Different GameMangers...");
        object->setGameManager(gm);
        if(gm) {
            DEBUG_A("Registering  object with gamemanager...");
            gm->registerObject(object);
        }
    }

    RigidBody* rb = dynamic_cast<RigidBody*>(object);
    if(rb) {
        rb->addBody(getPhysics());
    }

    Light* pl = dynamic_cast<Light*>(object);
    if(pl) {
        lights_.push_back(pl);
    }

    addChild(object);
}