本文整理汇总了C++中Reference::createChildObjects方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::createChildObjects方法的具体用法?C++ Reference::createChildObjects怎么用?C++ Reference::createChildObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::createChildObjects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleObjectMenuSelect
//.........这里部分代码省略.........
// Transfer crafting components from deed to droid
ManagedReference<SceneObject*> craftingComponents = getSlottedObject("crafted_components");
if(craftingComponents != NULL) {
SceneObject* satchel = craftingComponents->getContainerObject(0);
// remove all items form satchel and add int he new items
Vector<ManagedReference<SceneObject*> > toRemove;
for (int i = 0; i < satchel->getContainerObjectsSize(); ++i) {
ManagedReference<SceneObject*> sceno = satchel->getContainerObject(i);
if (sceno != NULL) {
toRemove.add(sceno);
}
}
satchel->removeAllContainerObjects();
for(int i=0;i<toRemove.size();i++) {
SceneObject* component = toRemove.get(i);
Locker componenetLocker(component);
component->destroyObjectFromWorld(true);
}
// this will change to use stacked modules. we wont care about non droid modules as they arent needed.
String key;
ManagedReference<DroidComponent*> comp = NULL;
HashTableIterator<String, ManagedReference<DroidComponent*> > iterator = modules.iterator();
droid->setResists(0);
droid->setHitChance(0);
for(int i = 0; i < modules.size(); ++i) {
iterator.getNextKeyAndValue(key, comp);
if (comp) {
satchel->transferObject(comp, -1, false);
DataObjectComponentReference* data = comp->getDataObjectComponent();
BaseDroidModuleComponent* module = NULL;
if(data != NULL && data->get() != NULL && data->get()->isDroidModuleData()) {
module = cast<BaseDroidModuleComponent*>(data->get());
module->initialize(droid);
}
}
}
droid->transferObject(craftingComponents, 4, false);
craftingComponents->setSendToClient(false);
}
// Copy color customization from deed to droid
CustomizationVariables* customVars = getCustomizationVariables();
if( customVars != NULL ){
for (int i = 0; i < customVars->size(); ++i) {
uint8 id = customVars->elementAt(i).getKey();
int16 val = customVars->elementAt(i).getValue();
String name = CustomizationIdManager::instance()->getCustomizationVariable(id);
if( name.contains( "color" ) ){
droid->setCustomizationVariable( name, val, true );
}
}
droid->refreshPaint();
}
StringId s;
s.setStringId(droid->getObjectName()->getFullPath());
controlDevice->setObjectName(s);
controlDevice->setPetType(PetManager::DROIDPET);
controlDevice->setMaxVitality(100);
controlDevice->setVitality(100);
droid->createChildObjects();
controlDevice->setControlledObject(droid);
controlDevice->setDefaultCommands();
if (!datapad->transferObject(controlDevice, -1)) {
controlDevice->destroyObjectFromDatabase(true);
return 1;
}
datapad->broadcastObject(controlDevice, true);
controlDevice->callObject(player);
droid->initDroidModules(true);
float maxHam = DroidMechanics::determineHam(overallQuality,species);
for (int i = 0; i < 9; ++i) {
if (i % 3 == 0) {
droid->setBaseHAM(i,maxHam,true);
droid->setHAM(i,maxHam,true);
} else {
droid->setBaseHAM(i,maxHam/100,true);
droid->setHAM(i,maxHam/100,true);
}
}
//Remove the deed from its container.
ManagedReference<SceneObject*> deedContainer = getParent().get();
if (deedContainer != NULL) {
destroyObjectFromWorld(true);
}
generated = true;
destroyObjectFromDatabase(true);
player->sendSystemMessage("@pet/pet_menu:device_added"); // "A control device has been added to your datapad."
return 0;
}
return DeedImplementation::handleObjectMenuSelect(player, selectedID);
}