本文整理汇总了C++中Creature::FindNearestCreature方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::FindNearestCreature方法的具体用法?C++ Creature::FindNearestCreature怎么用?C++ Creature::FindNearestCreature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::FindNearestCreature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test
void Test() override
{
switch (GetTestStep())
{
case 0:
{
Creature* c = SpawnCreature(1, 1);
if (!c)
Fail("Failed to summon a creature");
else if (c->GetMap() != GetMap())
Fail("Creature summoned on the wrong map");
else if (!c->FindNearestCreature(NPC_MAGMADAR, 50.0f))
Fail("Unit magmadar not found near creature");
SpawnPlayer(0, CLASS_WARLOCK, RACE_GNOME);
Wait(500);
NextStep();
break;
}
case 1:
{
Player* p = GetTestPlayer(0);
if (!p)
Fail("Unable to summon a player");
else if (p->getClass() != CLASS_WARLOCK && p->getRace() != RACE_GNOME)
Fail("Bad player class or race");
else if (p->FindMap() != GetMap())
Fail("Bad player map");
else if (p->GetInstanceId() != GetMap()->GetInstanceId())
Fail("Diff instance id (player vs map)");
else if (!p->FindNearestCreature(NPC_MAGMADAR, 50.0f))
Fail("Unit magmadar not found near player");
else
Finish();
return;
}
}
}