本文整理汇总了C++中RemoveFollowState函数的典型用法代码示例。如果您正苦于以下问题:C++ RemoveFollowState函数的具体用法?C++ RemoveFollowState怎么用?C++ RemoveFollowState使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RemoveFollowState函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddFollowState
void FollowerAI::SetFollowPaused(bool paused)
{
if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || HasFollowState(STATE_FOLLOW_COMPLETE))
return;
if (paused)
{
AddFollowState(STATE_FOLLOW_PAUSED);
if (me->HasUnitState(UNIT_STATE_FOLLOW))
{
me->ClearUnitState(UNIT_STATE_FOLLOW);
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
}
}
else
{
RemoveFollowState(STATE_FOLLOW_PAUSED);
if (Player* leader = GetLeaderForFollower())
me->GetMotionMaster()->MoveFollow(leader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
}
示例2: AddFollowState
void FollowerAI::SetFollowComplete(bool bWithEndEvent)
{
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
{
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
}
if (bWithEndEvent)
AddFollowState(STATE_FOLLOW_POSTEVENT);
else
{
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
RemoveFollowState(STATE_FOLLOW_POSTEVENT);
}
AddFollowState(STATE_FOLLOW_COMPLETE);
}
示例3: debug_log
void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !m_creature->getVictim())
{
if (m_uiUpdateFollowTimer < uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
debug_log("SD2: FollowerAI is set completed, despawns.");
m_creature->ForcedDespawn();
return;
}
bool bIsMaxRangeExceeded = true;
if (Player* pPlayer = GetLeaderForFollower())
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
debug_log("SD2: FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
return;
}
if (Group* pGroup = pPlayer->GetGroup())
{
for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next())
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
{
bIsMaxRangeExceeded = false;
break;
}
}
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE))
bIsMaxRangeExceeded = false;
}
}
if (bIsMaxRangeExceeded)
{
debug_log("SD2: FollowerAI failed because player/group was to far away or not found");
m_creature->ForcedDespawn();
return;
}
m_uiUpdateFollowTimer = 1000;
}
else
m_uiUpdateFollowTimer -= uiDiff;
}
UpdateFollowerAI(uiDiff);
}
示例4: TC_LOG_DEBUG
void FollowerAI::UpdateAI(uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !me->GetVictim())
{
if (m_uiUpdateFollowTimer <= uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
TC_LOG_DEBUG("scripts", "FollowerAI is set completed, despawns.");
me->DespawnOrUnsummon();
return;
}
bool bIsMaxRangeExceeded = true;
if (Player* player = GetLeaderForFollower())
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
TC_LOG_DEBUG("scripts", "FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
return;
}
if (Group* group = player->GetGroup())
{
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
{
Player* member = groupRef->GetSource();
if (member && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE))
{
bIsMaxRangeExceeded = false;
break;
}
}
}
else
{
if (me->IsWithinDistInMap(player, MAX_PLAYER_DISTANCE))
bIsMaxRangeExceeded = false;
}
}
if (bIsMaxRangeExceeded)
{
TC_LOG_DEBUG("scripts", "FollowerAI failed because player/group was to far away or not found");
me->DespawnOrUnsummon();
return;
}
m_uiUpdateFollowTimer = 1000;
}
else
m_uiUpdateFollowTimer -= uiDiff;
}
UpdateFollowerAI(uiDiff);
}
示例5: RemoveFollowState
void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !m_creature->getVictim())
{
if (m_uiUpdateFollowTimer < uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
sLog.outDebug("FollowerAI is set completed, despawns.");
m_creature->DisappearAndDie();
return;
}
bool bIsMaxRangeExceeded = true;
if (Player* pPlayer = GetLeaderForFollower())
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
sLog.outDebug("FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
m_creature->GetMotionMaster()->MoveFollow(pPlayer, m_uiFollowDistance, PET_FOLLOW_ANGLE);
return;
}
if (Group* pGroup = pPlayer->GetGroup())
{
for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != nullptr; pRef = pRef->next())
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
{
bIsMaxRangeExceeded = false;
break;
}
}
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE))
bIsMaxRangeExceeded = false;
}
// allow postEvent to happen even if quest credit is already handled
/*if (HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT))
bIsMaxRangeExceeded = false;*/
}
if (bIsMaxRangeExceeded)
{
sLog.outDebug("FollowerAI failed because player/group was to far away or not found");
SetFollowPaused(false);
m_creature->DisappearAndDie();
return;
}
m_uiUpdateFollowTimer = 300;
}
else
m_uiUpdateFollowTimer -= uiDiff;
}
UpdateFollowerAI(uiDiff);
}