本文整理汇总了C++中AiAgent::loadTemplateData方法的典型用法代码示例。如果您正苦于以下问题:C++ AiAgent::loadTemplateData方法的具体用法?C++ AiAgent::loadTemplateData怎么用?C++ AiAgent::loadTemplateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AiAgent
的用法示例。
在下文中一共展示了AiAgent::loadTemplateData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawnCreature
CreatureObject* CreatureManagerImplementation::spawnCreature(uint32 templateCRC, uint32 objectCRC, float x, float z, float y, uint64 parentID, bool persistent) {
CreatureTemplate* creoTempl = creatureTemplateManager->getTemplate(templateCRC);
if (creoTempl == NULL)
return spawnCreature(objectCRC, x, z, y, parentID);
CreatureObject* creature = NULL;
String templateToSpawn;
if (objectCRC == 0) {
templateToSpawn = getTemplateToSpawn(templateCRC);
objectCRC = templateToSpawn.hashCode();
}
creature = createCreature(objectCRC, persistent, templateCRC);
if (creature != NULL && creature->isAiAgent()) {
AiAgent* npc = cast<AiAgent*>(creature);
npc->loadTemplateData(creoTempl);
} else if (creature == NULL) {
error("could not spawn template " + templateToSpawn);
}
placeCreature(creature, x, z, y, parentID);
return creature;
}
示例2: spawnCreatureAsEventMob
CreatureObject* CreatureManagerImplementation::spawnCreatureAsEventMob(uint32 templateCRC, float x, float z, float y, uint64 parentID) {
CreatureTemplate* creoTempl = creatureTemplateManager->getTemplate(templateCRC);
if (creoTempl == NULL)
return NULL;
CreatureObject* creo = NULL;
String templateToSpawn = getTemplateToSpawn(templateCRC);
uint32 objectCRC = templateToSpawn.hashCode();
creo = createCreature(objectCRC, false, templateCRC);
if (creo != NULL && creo->isAiAgent()) {
AiAgent* creature = cast<AiAgent*>(creo);
creature->loadTemplateData(creoTempl);
UnicodeString eventName;
eventName = creature->getDisplayedName() + " (event)";
creature->setCustomObjectName(eventName, false);
} else if (creo == NULL) {
error("could not spawn template " + templateToSpawn);
}
placeCreature(creo, x, z, y, parentID);
if (creo != NULL && creo->isAiAgent())
cast<AiAgent*>(creo)->activateLoad("");
return creo;
}