本文整理汇总了C++中UnitPointer::GetDistanceSq方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPointer::GetDistanceSq方法的具体用法?C++ UnitPointer::GetDistanceSq怎么用?C++ UnitPointer::GetDistanceSq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPointer
的用法示例。
在下文中一共展示了UnitPointer::GetDistanceSq方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleRangeCheckCommand
bool ChatHandler::HandleRangeCheckCommand( const char *args , WorldSession *m_session )
{
WorldPacket data;
uint64 guid = m_session->GetPlayer()->GetSelection();
m_session->SystemMessage( "=== RANGE CHECK ===" );
if (guid == 0)
{
m_session->SystemMessage("No selection imo.");
return true;
}
UnitPointer unit = m_session->GetPlayer()->GetMapMgr()->GetUnit( guid );
if(!unit)
{
m_session->SystemMessage("Invalid selection imo.");
return true;
}
float DistSq = unit->GetDistanceSq( TO_OBJECT(m_session->GetPlayer()) );
m_session->SystemMessage( "GetDistanceSq : %u" , FL2UINT( DistSq ) );
LocationVector locvec( m_session->GetPlayer()->GetPositionX() , m_session->GetPlayer()->GetPositionY() , m_session->GetPlayer()->GetPositionZ() );
float DistReal = unit->CalcDistance( locvec );
m_session->SystemMessage( "CalcDistance : %u" , FL2UINT( DistReal ) );
float Dist2DSq = unit->GetDistance2dSq( TO_OBJECT(m_session->GetPlayer()) );
m_session->SystemMessage( "GetDistance2dSq: %u" , FL2UINT( Dist2DSq ) );
return true;
}