本文整理汇总了C++中CASW_Player::GetUseEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Player::GetUseEntity方法的具体用法?C++ CASW_Player::GetUseEntity怎么用?C++ CASW_Player::GetUseEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASW_Player
的用法示例。
在下文中一共展示了CASW_Player::GetUseEntity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindDoor
CASW_Door* CASW_Weapon_Welder::FindDoor()
{
CASW_Marine *pMarine = GetMarine();
if ( !pMarine )
return NULL;
if ( pMarine->IsInhabited() )
{
CASW_Player *pPlayer = pMarine->GetCommander();
if ( !pPlayer )
return NULL;
// find our door area
for ( int i = 0; i < pPlayer->GetNumUseEntities(); i++ )
{
CBaseEntity* pEnt = pPlayer->GetUseEntity( i );
CASW_Door_Area* pDoorArea = dynamic_cast< CASW_Door_Area* >( pEnt );
if ( pDoorArea )
{
CASW_Door* pDoor = pDoorArea->GetASWDoor();
if ( pDoor && pDoor->GetHealth() > 0 )
{
return pDoor;
}
}
}
}
else
{
#ifdef GAME_DLL
CASW_Door_Area *pClosestArea = NULL;
float flClosestDist = FLT_MAX;
for ( int i = 0; i < IASW_Use_Area_List::AutoList().Count(); i++ )
{
CASW_Use_Area *pArea = static_cast< CASW_Use_Area* >( IASW_Use_Area_List::AutoList()[ i ] );
if ( pArea->Classify() == CLASS_ASW_DOOR_AREA )
{
CASW_Door_Area *pDoorArea = assert_cast<CASW_Door_Area*>( pArea );
CASW_Door* pDoor = pDoorArea->GetASWDoor();
if ( !pDoor || pDoor->GetHealth() <= 0 )
{
continue;
}
float flDist = GetAbsOrigin().DistTo( pArea->WorldSpaceCenter() );
if ( flDist < flClosestDist && pArea->CollisionProp()->IsPointInBounds( pMarine->WorldSpaceCenter() ) )
{
flClosestDist = flDist;
pClosestArea = pDoorArea;
}
}
}
if ( pClosestArea )
{
CASW_Door* pDoor = pClosestArea->GetASWDoor();
if ( pDoor )
{
return pDoor;
}
}
#endif
}
return NULL;
}