void MScene::updateObjectsBehaviors(void) { unsigned int i; unsigned int oSize = getObjectsNumber(); for(i=0; i<oSize; i++) { MObject3d * object = getObjectByIndex(i); if(! object->isActive()) continue; object->updateBehaviors(); } }
void MGame::update(void) { MEngine * engine = MEngine::getInstance(); // run script if(engine->getScriptContext()) engine->getScriptContext()->callFunction("onSceneUpdate"); // get level MLevel * level = MEngine::getInstance()->getLevel(); if(! level) return; // get current scene MScene * scene = level->getCurrentScene(); if(! scene) return; // update behaviors unsigned int i; unsigned int oSize = scene->getObjectsNumber(); for(i=0; i<oSize; i++) { MObject3d * object = scene->getObjectByIndex(i); if(! object->isActive()) continue; object->updateBehaviors(); } // update scene scene->update(); // update physics scene->updatePhysics(); // update objects matrices scene->updateObjectsMatrices(); // flush input engine->getInputContext()->flush(); }