本文整理汇总了C++中CTFPlayer::GetCollisionGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFPlayer::GetCollisionGroup方法的具体用法?C++ CTFPlayer::GetCollisionGroup怎么用?C++ CTFPlayer::GetCollisionGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFPlayer
的用法示例。
在下文中一共展示了CTFPlayer::GetCollisionGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TeleporterThink
//.........这里部分代码省略.........
// move the player
if ( pTeleportingPlayer )
{
CUtlVector<CBaseEntity*> hPlayersToKill;
bool bClear = true;
// Telefrag any players in the way
int numEnts = UTIL_EntitiesInBox( pEnts, 256, mins, maxs, 0 );
if ( numEnts )
{
//Iterate through the list and check the results
for ( int i = 0; i < numEnts && bClear; i++ )
{
if ( pEnts[i] == NULL )
continue;
if ( pEnts[i] == this )
continue;
// kill players
if ( pEnts[i]->IsPlayer() )
{
if ( !pTeleportingPlayer->InSameTeam(pEnts[i]) )
{
hPlayersToKill.AddToTail( pEnts[i] );
}
continue;
}
if ( pEnts[i]->IsBaseObject() )
continue;
// Solid entities will prevent a teleport
if ( pEnts[i]->IsSolid() && pEnts[i]->ShouldCollide( pTeleportingPlayer->GetCollisionGroup(), MASK_ALL ) &&
g_pGameRules->ShouldCollide( pTeleportingPlayer->GetCollisionGroup(), pEnts[i]->GetCollisionGroup() ) )
{
// We're going to teleport into something solid. Abort & destroy this exit.
bClear = false;
}
}
}
if ( bClear )
{
// Telefrag all enemy players we've found
for ( int player = 0; player < hPlayersToKill.Count(); player++ )
{
CTakeDamageInfo info( this, pTeleportingPlayer, 1000, DMG_CRUSH, TF_DMG_TELEFRAG );
hPlayersToKill[player]->TakeDamage( info );
}
pTeleportingPlayer->Teleport( &newPosition, &(GetAbsAngles()), &vec3_origin );
// Unzoom if we are a sniper zoomed!
if ( ( pTeleportingPlayer->GetPlayerClass()->GetClassIndex() == TF_CLASS_SNIPER ) &&
pTeleportingPlayer->m_Shared.InCond( TF_COND_AIMING ) )
{
CTFWeaponBase *pWpn = pTeleportingPlayer->GetActiveTFWeapon();
if ( pWpn && pWpn->GetWeaponID() == TF_WEAPON_SNIPERRIFLE )
{
CTFSniperRifle *pRifle = static_cast<CTFSniperRifle*>( pWpn );
pRifle->ToggleZoom();
}
}
示例2: TeleporterThink
//.........这里部分代码省略.........
// move the player
if ( pTeleportingPlayer )
{
CUtlVector<CBaseEntity*> hPlayersToKill;
bool bClear = true;
// Telefrag any players in the way
int numEnts = UTIL_EntitiesInBox( pEnts, 256, mins, maxs, 0 );
if ( numEnts )
{
//Iterate through the list and check the results
for ( int i = 0; i < numEnts && bClear; i++ )
{
if ( pEnts[i] == NULL )
continue;
if ( pEnts[i] == this )
continue;
// kill players and NPCs
if ( pEnts[i]->IsPlayer() || pEnts[i]->IsNPC() )
{
if ( !pTeleportingPlayer->InSameTeam(pEnts[i]) )
{
hPlayersToKill.AddToTail( pEnts[i] );
}
continue;
}
if ( pEnts[i]->IsBaseObject() )
continue;
// Solid entities will prevent a teleport
if ( pEnts[i]->IsSolid() && pEnts[i]->ShouldCollide( pTeleportingPlayer->GetCollisionGroup(), MASK_ALL ) &&
g_pGameRules->ShouldCollide( pTeleportingPlayer->GetCollisionGroup(), pEnts[i]->GetCollisionGroup() ) )
{
// We're going to teleport into something solid. Abort & destroy this exit.
bClear = false;
}
}
}
if ( bClear )
{
// Telefrag all enemy players we've found
for ( int player = 0; player < hPlayersToKill.Count(); player++ )
{
hPlayersToKill[player]->TakeDamage( CTakeDamageInfo( pTeleportingPlayer, this, 1000, DMG_CRUSH ) );
}
pTeleportingPlayer->Teleport( &newPosition, &(GetAbsAngles()), &vec3_origin );
// Unzoom if we are a sniper zoomed!
if ( ( pTeleportingPlayer->GetPlayerClass()->GetClassIndex() == TF_CLASS_SNIPER ) &&
pTeleportingPlayer->m_Shared.InCond( TF_COND_AIMING ) )
{
CTFWeaponBase *pWpn = pTeleportingPlayer->GetActiveTFWeapon();
if ( pWpn && pWpn->GetWeaponID() == TF_WEAPON_SNIPERRIFLE )
{
CTFSniperRifle *pRifle = static_cast<CTFSniperRifle*>( pWpn );
pRifle->ToggleZoom();
}
}
pTeleportingPlayer->SetFOV( pTeleportingPlayer, 0, tf_teleporter_fov_time.GetFloat(), tf_teleporter_fov_start.GetInt() );