本文整理汇总了C++中GameObject::FindNearestCreature方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::FindNearestCreature方法的具体用法?C++ GameObject::FindNearestCreature怎么用?C++ GameObject::FindNearestCreature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject::FindNearestCreature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ItemUse_item_pile_fake_furs
bool ItemUse_item_pile_fake_furs(Player *pPlayer, Item * /*pItem*/, SpellCastTargets const & /*targets*/)
{
GameObject *pGo = NULL;
for (uint8 i = 0; i < CaribouTrapsNum; ++i)
{
pGo = pPlayer->FindNearestGameObject(CaribouTraps[i], 5.0f);
if (pGo)
break;
}
if (!pGo)
return false;
if (pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || pGo->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f))
return true;
float x, y, z;
pGo->GetClosePoint(x, y, z, pGo->GetObjectSize() / 3, 7.0f);
pGo->SummonGameObject(GO_HIGH_QUALITY_FUR, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, 0, 0, 0, 0, 1000);
if (TempSummon* summon = pPlayer->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, pGo->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
{
summon->SetVisibility(VISIBILITY_OFF);
summon->SetReactState(REACT_PASSIVE);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
}
return false;
}
示例2: OnUse
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/)
{
GameObject* go = NULL;
for (uint8 i = 0; i < CaribouTrapsNum; ++i)
{
go = player->FindNearestGameObject(CaribouTraps[i], 5.0f);
if (go)
break;
}
if (!go)
return false;
if (go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || go->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f))
return true;
float x, y, z;
go->GetClosePoint(x, y, z, go->GetObjectSize() / 3, 7.0f);
go->SummonGameObject(GO_HIGH_QUALITY_FUR, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, 0, 0, 0, 0, 1000);
if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
{
summon->SetVisible(false);
summon->SetReactState(REACT_PASSIVE);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
}
return false;
}
示例3: OnUse
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/) override
{
GameObject* go = nullptr;
for (uint8 i = 0; i < CaribouTrapsNum; ++i)
{
go = player->FindNearestGameObject(CaribouTraps[i], 5.0f);
if (go)
break;
}
if (!go)
return false;
if (go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || go->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f))
return true;
float x, y, z;
go->GetClosePoint(x, y, z, go->GetCombatReach() / 3, 7.0f);
go->SummonGameObject(GO_HIGH_QUALITY_FUR, *go, QuaternionData(), 1);
if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
{
summon->SetVisible(false);
summon->SetReactState(REACT_PASSIVE);
summon->SetImmuneToPC(true);
}
return false;
}