本文整理汇总了C++中Creature::CalcDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::CalcDistance方法的具体用法?C++ Creature::CalcDistance怎么用?C++ Creature::CalcDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::CalcDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnQuestStart
void OnQuestStart(Player* pPlayer, QuestLogEntry* qLogEntry)
{
Creature *windwatcher = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 6176);
if(!windwatcher) return;
// questgiver will walk to the place where Cyclonian is spawned
// only walk when we are at home
if(windwatcher->CalcDistance(250.839996f, -1470.579956f, 55.4491f) > 1) return;
{
windwatcher->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Follow me");
sEAS.CreateCustomWaypointMap(windwatcher);
sEAS.WaypointCreate(windwatcher, 269.29f, -1433.32f, 50.31f, 0.19f, 0, 0, 0);
sEAS.WaypointCreate(windwatcher, 328.52f, -1442.03f, 40.5f, 5.65f, 0, 0, 0);
sEAS.WaypointCreate(windwatcher, 333.31f, -1453.69f, 42.01f, 4.68f, 0, 0, 0);
sEAS.EnableWaypoints(windwatcher);
windwatcher->GetAIInterface()->setMoveType(11);
}
windwatcher->Despawn(15*60*1000, 0);
// spawn cyclonian if not spawned already
Creature *cyclonian = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(323.947f, -1483.68f, 43.1363f, 6239);
if( cyclonian == NULL)
{
cyclonian = sEAS.SpawnCreature(pPlayer, 6239, 323.947f, -1483.68f, 43.1363f, 0.682991f);
// if spawning cyclonian failed, we have to return.
if(cyclonian == NULL)
return;
}
// queue cyclonian for despawn
cyclonian->Despawn(15*60*1000, 0);
}
示例2:
Creature *MapManagerScript::FindClosestLivingCreature( uint32 pEntry, float pX, float pY, float pZ, Creature* check )
{
Creature *CurrentCreature = NULL, *Creturn = NULL;
float closestDistance = 50000.0f, currentDistance;
for ( uint32 i = 0; i != _manager->m_CreatureHighGuid; ++i )
{
currentDistance = 0.0f;
CurrentCreature = _manager->m_CreatureStorage[i];
if ( CurrentCreature != NULL && CurrentCreature != check)
{
if ( CurrentCreature->GetEntry() == pEntry && CurrentCreature->isAlive())
{
currentDistance = CurrentCreature->CalcDistance(pX, pY, pZ);
if(currentDistance <= closestDistance)
{
closestDistance = currentDistance;
Creturn = CurrentCreature;
}
}
}
}
return Creturn;
}