本文整理汇总了C++中NPC::setTimeAICheck方法的典型用法代码示例。如果您正苦于以下问题:C++ NPC::setTimeAICheck方法的具体用法?C++ NPC::setTimeAICheck怎么用?C++ NPC::setTimeAICheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPC
的用法示例。
在下文中一共展示了NPC::setTimeAICheck方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runMap
void WorldServer::runMap(Map* curMap) {
if (!curMap)
return;
#else
void runMap(Map* curMap) {
if (!curMap)
return;
ChronoTimer t;
dword_t timePerFrame = (1000 / 60);
do {
long long timeDiff = timePerFrame - (t.getDuration());
t.update();
if (timeDiff > 0) {
Sleep(timeDiff);
}
if (!curMap->hasActivePlayers()) {
continue;
}
#endif
Player* curPlayer = nullptr;
NPC* curNPC = nullptr;
Map::Sector* newSector = nullptr;
LinkedList<Entity*> entityToRemove;
for(unsigned int i=0;i<curMap->getSectorCount();i++) {
Map::Sector* curSector = curMap->getSector(i);
LinkedList<Entity*>::Node* entityNode = curSector->getFirstEntity();
bool updateNextNode = false;
while(entityNode) {
if(updateNextNode) {
entityNode = entityNode->getNextNode();
if(!entityNode)
break;
}
updateNextNode = true;
Entity* curEntity = entityNode->getValue();
if (!curEntity || !curEntity->isIngame() || curEntity->getEntityType() == Entity::TYPE_DROP) {
continue;
}
byte_t result = curEntity->movementRoutine();
if (result & Entity::Movement::INITIAL_ATTACK) {
curEntity->getAttackAnimation();
}
if (result & Entity::Movement::TARGET_REACHED) {
bool isProcFrameReached = curEntity->playAnimation();
}
if ((newSector = curEntity->checkForNewSector()) != nullptr) {
entityNode = curEntity->setSector(newSector);
curEntity->checkVisuality();
if (entityNode) {//in case we have a valid succeeding node
updateNextNode = false;
}
}
switch (curEntity->getEntityType()) {
case Entity::TYPE_PLAYER:
curPlayer = dynamic_cast<Player*>(curEntity);
curPlayer->checkRegeneration();
break;
case Entity::TYPE_NPC:
case Entity::TYPE_MONSTER:
curNPC = dynamic_cast<NPC*>(curEntity);
if (result == Entity::Movement::IDLE) {
//In case the NPC/Monster is idling
//run AI with state "IDLE"
if(curEntity->getTarget() == NULL) {
AIService::run(curNPC, AIP::ON_IDLE);
} else {
AIService::run(curNPC, AIP::ON_ATTACK);
}
} else {
//In case it's walking and has no target
//i.e. walking around/away
if (curEntity->getTarget() == NULL) {
curNPC->setTimeAICheck();
} else {
AIService::run(curNPC, AIP::ON_ATTACK);
}
}
break;
}
}
}
curMap->checkSpawns();
#ifdef __ROSE_MULTI_THREADED__
} while (true);
#endif
}
bool WorldServer::loadSTBs() {
std::cout << "Reading all STBs...\r";
#ifdef __ROSE_USE_VFS__
VFSData fileBuf;
this->aiFile = new AISTB(this->vfs, "3DDATA\\STB\\FILE_AI.STB");
this->npcFile = new NPCSTB(this->vfs, "3DDATA\\STB\\LIST_NPC.STB");
this->skillFile = new SkillSTB(this->vfs, "3DDATA\\STB\\LIST_SKILL.STB");
this->dropFile = new STBFile(this->vfs, "3DDATA\\STB\\ITEM_DROP.STB");
this->zoneFile = new ZoneSTB(this->vfs, "3DDATA\\STB\\LIST_ZONE.STB");
this->questFile = new STBFile(this->vfs, "3DDATA\\STB\\LIST_QUEST.STB", false);
//.........这里部分代码省略.........