本文整理汇总了C++中CreatureObject::teleport方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::teleport方法的具体用法?C++ CreatureObject::teleport怎么用?C++ CreatureObject::teleport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureObject
的用法示例。
在下文中一共展示了CreatureObject::teleport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyEnter
void FsVillageAreaImplementation::notifyEnter(SceneObject* player) {
ActiveAreaImplementation::notifyEnter(player);
if (!player->isPlayerCreature()) {
return;
}
float x = player->getPositionX();
float y = player->getPositionY();
float diffY = y - getPositionY();
float diffX = x - getPositionX();
float angle = atan2(diffY == 0.f ? 1 : diffY, diffX == 0.f ? 1 : diffX);
CreatureObject* playerCreature = cast<CreatureObject*>(player);
PlayerObject* ghost = playerCreature->getPlayerObject();
float rad = getRadius() * 1.05;
float newPosX = getPositionX() + (cos(angle) * rad);
float newPosY = getPositionY() + (sin(angle) * rad);
// Those who aren't a valid player, do not currently have or have had the Village elder quest cannot enter.
if (ghost != NULL) {
if (ghost->hasGodMode())
return;
if (!ghost->hasActiveQuestBitSet(PlayerQuestData::FS_VILLAGE_ELDER) && !ghost->hasCompletedQuestsBitSet(PlayerQuestData::FS_VILLAGE_ELDER)) {
playerCreature->teleport(newPosX, getZone()->getHeight(newPosX, newPosY), newPosY, 0);
playerCreature->sendSystemMessage("@base_player:fs_village_unavailable");
} else if (playerCreature->isInCombat()) {
playerCreature->teleport(newPosX, getZone()->getHeight(newPosX, newPosY), newPosY, 0);
playerCreature->sendSystemMessage("@base_player:fs_village_no_combat");
}
}
}