本文整理汇总了C++中AiAgent::setFollowObject方法的典型用法代码示例。如果您正苦于以下问题:C++ AiAgent::setFollowObject方法的具体用法?C++ AiAgent::setFollowObject怎么用?C++ AiAgent::setFollowObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AiAgent
的用法示例。
在下文中一共展示了AiAgent::setFollowObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawnObject
void PetControlDeviceImplementation::spawnObject(CreatureObject* player) {
ZoneServer* zoneServer = getZoneServer();
ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();
if (controlledObject == NULL)
return;
if (!isASubChildOf(player))
return;
ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
if (tradeContainer != NULL) {
server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(player);
}
controlledObject->initializePosition(player->getPositionX(), player->getPositionZ(), player->getPositionY());
ManagedReference<CreatureObject*> creature = NULL;
if (controlledObject->isCreatureObject()) {
creature = cast<CreatureObject*>(controlledObject.get());
creature->setCreatureLink(player);
creature->setControlDevice(_this.get());
creature->setFaction(player->getFaction());
creature->setObjectMenuComponent("PetMenuComponent");
if (player->getPvpStatusBitmask() & CreatureFlag::PLAYER)
creature->setPvpStatusBitmask(player->getPvpStatusBitmask() - CreatureFlag::PLAYER, true);
else
creature->setPvpStatusBitmask(player->getPvpStatusBitmask(), true);
}
Zone* zone = player->getZone();
if (zone == NULL)
return;
ManagedReference<SceneObject*> parent = player->getParent();
if (parent != NULL && parent->isCellObject())
parent->transferObject(controlledObject, -1, true);
else
zone->transferObject(controlledObject, -1, true);
updateStatus(1);
if (petControlObserver != NULL)
player->dropObserver(ObserverEventType::STARTCOMBAT, petControlObserver);
AiAgent* pet = cast<AiAgent*>(creature.get());
if (pet == NULL)
return;
ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
ghost->addToActivePets(pet);
if (pet->isDroidObject()) {
DroidObject* droid = cast<DroidObject*>(pet);
if( droid == NULL )
return;
// Sanity check that there isn't another power task outstanding
droid->removePendingTask( "droid_power" );
// Submit new power task
Reference<Task*> droidPowerTask = new DroidPowerTask( droid );
droid->addPendingTask("droid_power", droidPowerTask, 120000); // 2 min
if( droid->hasPower() ){
// TODO Temporarily set to autofollow player
droid->setFollowObject(player);
}
else{
droid->handleLowPower();
}
} else {
pet->setFollowObject(player);
}
// Not training any commands
trainingCommand = 0;
}