本文整理汇总了C++中CharmInfo::GetStayPosY方法的典型用法代码示例。如果您正苦于以下问题:C++ CharmInfo::GetStayPosY方法的具体用法?C++ CharmInfo::GetStayPosY怎么用?C++ CharmInfo::GetStayPosY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharmInfo
的用法示例。
在下文中一共展示了CharmInfo::GetStayPosY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAI
//.........这里部分代码省略.........
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
m_unit->SendCreateUpdateToPlayer((Player*)owner);
}
spell->SpellStart(&targets);
}
// deleted cached Spell objects
for (TargetSpellList::const_iterator itr = targetSpellStore.begin(); itr != targetSpellStore.end(); ++itr)
delete itr->second;
}
// Stop here if casting spell (No melee and no movement)
if (m_unit->IsNonMeleeSpellCasted(false))
return;
// we may get our actions disabled during spell casting, so do entire recheck for victim
victim = (pet && pet->GetModeFlags() & PET_MODE_DISABLE_ACTIONS) ? nullptr : m_unit->getVictim();
if (victim)
{
// i_pet.getVictim() can't be used for check in case stop fighting, i_pet.getVictim() clear at Unit death etc.
// This is needed for charmed creatures, as once their target was reset other effects can trigger threat
if (!victim->isTargetableForAttack())
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "PetAI (guid = %u) is stopping attack.", m_unit->GetGUIDLow());
m_unit->CombatStop();
inCombat = false;
return;
}
// if pet misses its target, it will also be the first in threat list
if ((!creature || !(creature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_MELEE))
&& m_unit->CanReachWithMeleeAttack(victim))
{
if (!m_unit->HasInArc(2 * M_PI_F / 3, victim))
{
m_unit->SetInFront(victim);
if (victim->GetTypeId() == TYPEID_PLAYER)
m_unit->SendCreateUpdateToPlayer((Player*)victim);
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
m_unit->SendCreateUpdateToPlayer((Player*)owner);
}
DoMeleeAttackIfReady();
}
else if (!m_unit->hasUnitState(UNIT_STAT_MOVING))
AttackStart(victim);
}
else if (owner)
{
CharmInfo* charmInfo = m_unit->GetCharmInfo();
if (owner->isInCombat() && !(charmInfo && charmInfo->HasReactState(REACT_PASSIVE)))
AttackStart(owner->getAttackerForHelper());
else
{
if (charmInfo && charmInfo->HasCommandState(COMMAND_STAY))
{
//if stay command is set but we don't have stay pos set then we need to establish current pos as stay position
if (!charminfo->IsStayPosSet())
charminfo->SetStayPosition(true);
float stayPosX = charminfo->GetStayPosX();
float stayPosY = charminfo->GetStayPosY();
float stayPosZ = charminfo->GetStayPosZ();
if (m_unit->GetPositionX() == stayPosX
&& m_unit->GetPositionY() == stayPosY
&& m_unit->GetPositionZ() == stayPosZ)
{
float StayPosO = charminfo->GetStayPosO();
if (m_unit->hasUnitState(UNIT_STAT_MOVING))
{
m_unit->GetMotionMaster()->Clear(false);
m_unit->GetMotionMaster()->MoveIdle();
}
else if (m_unit->GetOrientation() != StayPosO)
m_unit->SetOrientation(StayPosO);
}
else
m_unit->GetMotionMaster()->MovePoint(0, stayPosX, stayPosY, stayPosZ, false);
}
else if (m_unit->hasUnitState(UNIT_STAT_FOLLOW))
{
if (owner->IsWithinDistInMap(m_unit, PET_FOLLOW_DIST))
{
m_unit->GetMotionMaster()->Clear(false);
m_unit->GetMotionMaster()->MoveIdle();
}
}
else if (charmInfo && charmInfo->HasCommandState(COMMAND_FOLLOW)
&& !owner->IsWithinDistInMap(m_unit, (PET_FOLLOW_DIST * 2)))
m_unit->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
}
}