本文整理匯總了C++中ObjectManager::cloneObject方法的典型用法代碼示例。如果您正苦於以下問題:C++ ObjectManager::cloneObject方法的具體用法?C++ ObjectManager::cloneObject怎麽用?C++ ObjectManager::cloneObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::cloneObject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: if
Reference<FactoryCrate*> TangibleObjectImplementation::createFactoryCrate(bool insertSelf) {
String file;
uint32 type = getGameObjectType();
if(type & SceneObjectType::ARMOR)
file = "object/factory/factory_crate_armor.iff";
else if(type == SceneObjectType::CHEMICAL || type == SceneObjectType::PHARMACEUTICAL || type == SceneObjectType::PETMEDECINE)
file = "object/factory/factory_crate_chemicals.iff";
else if(type & SceneObjectType::CLOTHING)
file = "object/factory/factory_crate_clothing.iff";
else if(type == SceneObjectType::ELECTRONICS)
file = "object/factory/factory_crate_electronics.iff";
else if(type == SceneObjectType::FOOD || type == SceneObjectType::DRINK)
file = "object/factory/factory_crate_food.iff";
else if(type == SceneObjectType::FURNITURE)
file = "object/factory/factory_crate_furniture.iff";
else if(type & SceneObjectType::INSTALLATION)
file = "object/factory/factory_crate_installation.iff";
else if(type & SceneObjectType::WEAPON)
file = "object/factory/factory_crate_weapon.iff";
else
file = "object/factory/factory_crate_generic_items.iff";
ObjectManager* objectManager = ObjectManager::instance();
Reference<FactoryCrate*> crate = (getZoneServer()->createObject(file.hashCode(), 2)).castTo<FactoryCrate*>();
if (crate == NULL)
return NULL;
SharedTangibleObjectTemplate* tanoData = dynamic_cast<SharedTangibleObjectTemplate*>(templateObject.get());
if (tanoData == NULL)
return NULL;
crate->setMaxCapacity(tanoData->getFactoryCrateSize());
if (insertSelf) {
crate->transferObject(_this.get(), -1, false);
} else {
ManagedReference<TangibleObject*> protoclone = cast<TangibleObject*>( objectManager->cloneObject(_this.get()));
if (protoclone == NULL)
return NULL;
protoclone->setParent(NULL);
crate->transferObject(protoclone, -1, false);
}
crate->setCustomObjectName(getCustomObjectName(), false);
crate->setUseCount(1);
return crate;
}