本文整理汇总了C++中CreatureObject::isAiAgent方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::isAiAgent方法的具体用法?C++ CreatureObject::isAiAgent怎么用?C++ CreatureObject::isAiAgent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureObject
的用法示例。
在下文中一共展示了CreatureObject::isAiAgent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: notifyDestruction
void LairObserverImplementation::notifyDestruction(TangibleObject* lair, TangibleObject* attacker, int condition) {
ThreatMap* threatMap = lair->getThreatMap();
Reference<DisseminateExperienceTask*> deTask = new DisseminateExperienceTask(lair, threatMap, &spawnedCreatures);
deTask->execute();
threatMap->removeObservers();
threatMap->removeAll(); // we can clear the original one
if (lair->getZone() == NULL) {
spawnedCreatures.removeAll();
return;
}
PlayClientEffectObjectMessage* explode = new PlayClientEffectObjectMessage(lair, "clienteffect/lair_damage_heavy.cef", "");
lair->broadcastMessage(explode, false);
PlayClientEffectLoc* explodeLoc = new PlayClientEffectLoc("clienteffect/lair_damage_heavy.cef", lair->getZone()->getZoneName(), lair->getPositionX(), lair->getPositionZ(), lair->getPositionY());
lair->broadcastMessage(explodeLoc, false);
lair->destroyObjectFromWorld(true);
for (int i = 0; i < spawnedCreatures.size(); ++i) {
CreatureObject* obj = spawnedCreatures.get(i);
if (obj->isAiAgent())
(cast<AiAgent*>(obj))->setDespawnOnNoPlayerInRange(true);
}
spawnedCreatures.removeAll();
}
示例3: 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;
}
示例4: spawnCreatureAsBaby
CreatureObject* CreatureManagerImplementation::spawnCreatureAsBaby(uint32 templateCRC, float x, float z, float y, uint64 parentID) {
CreatureTemplate* creoTempl = creatureTemplateManager->getTemplate(templateCRC);
if (creoTempl == NULL || creoTempl->getTame() <= 0)
return NULL;
CreatureObject* creo = NULL;
String templateToSpawn = getTemplateToSpawn(templateCRC);
uint32 objectCRC = templateToSpawn.hashCode();
creo = createCreature(objectCRC, false, templateCRC);
if (creo != NULL && creo->isCreature()) {
Creature* creature = cast<Creature*>(creo);
creature->loadTemplateDataForBaby(creoTempl);
} else {
error("could not spawn template " + templateToSpawn + " as baby.");
creo = NULL;
}
placeCreature(creo, x, z, y, parentID);
if (creo != NULL && creo->isAiAgent())
cast<AiAgent*>(creo)->activateLoad("");
else {
error("could not spawn template " + templateToSpawn + " as baby with AI.");
creo = NULL;
}
return creo;
}
示例5: spawnCreatureWithAi
CreatureObject* CreatureManagerImplementation::spawnCreatureWithAi(uint32 templateCRC, float x, float z, float y, uint64 parentID, bool persistent) {
CreatureObject* creature = spawnCreature(templateCRC, 0, x, z, y, parentID, persistent);
if (creature != NULL && creature->isAiAgent())
cast<AiAgent*>(creature)->activateLoad("");
else {
error("could not spawn template " + String::valueOf(templateCRC) + " with AI.");
creature = NULL;
}
return creature;
}
示例6: despawnSpawns
void SpawnObserverImplementation::despawnSpawns() {
for (int i = 0; i < spawnedCreatures.size(); ++i) {
CreatureObject* obj = spawnedCreatures.get(i);
if (obj->isAiAgent()) {
AiAgent* aiObj = cast<AiAgent*>(obj);
Locker locker(aiObj);
aiObj->setDespawnOnNoPlayerInRange(true);
}
}
spawnedCreatures.removeAll();
}
示例7: doAggro
void LairObserverImplementation::doAggro(TangibleObject* lair, TangibleObject* attacker, bool allAttack){
for (int i = 0; i < spawnedCreatures.size() ; ++i) {
CreatureObject* creo = spawnedCreatures.get(i);
if (creo->isDead() || creo->getZone() == NULL)
continue;
if (creo->isAiAgent() && attacker != NULL && (allAttack || (System::random(1) == 1))) {
// TODO: only set defender if needed
AiAgent* ai = cast<AiAgent*>( creo);
Locker clocker(creo, lair);
creo->setDefender(attacker);
}
}
}