本文整理汇总了C++中CBaseTFPlayer::InSameTeam方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseTFPlayer::InSameTeam方法的具体用法?C++ CBaseTFPlayer::InSameTeam怎么用?C++ CBaseTFPlayer::InSameTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseTFPlayer
的用法示例。
在下文中一共展示了CBaseTFPlayer::InSameTeam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClassThink
//-----------------------------------------------------------------------------
// Purpose: Called every frame by postthink
//-----------------------------------------------------------------------------
void CPlayerClassCommando::ClassThink( void )
{
// Check bullrush
m_ClassData.m_bCanBullRush = true;
// Do the init thing here!
if ( m_bOldBullRush != m_ClassData.m_bBullRush )
{
if ( m_ClassData.m_bBullRush )
{
PreBullRush();
}
else
{
PostBullRush();
}
m_bOldBullRush = (bool)m_ClassData.m_bBullRush;
}
// Check for melee attack
if ( m_bCanBoot && m_pPlayer->IsAlive() && m_flNextBootCheck < gpGlobals->curtime )
{
m_flNextBootCheck = gpGlobals->curtime + 0.2;
CBaseEntity *pEntity = NULL;
Vector vecSrc = m_pPlayer->Weapon_ShootPosition( );
Vector vecDir = m_pPlayer->BodyDirection2D( );
Vector vecTarget = vecSrc + (vecDir * 48);
for ( CEntitySphereQuery sphere( vecTarget, 16 ); pEntity = sphere.GetCurrentEntity(); sphere.NextEntity() )
{
if ( pEntity->IsPlayer() && (pEntity != m_pPlayer) )
{
CBaseTFPlayer *pPlayer = (CBaseTFPlayer *)pEntity;
// Target needs to be on the enemy team
if ( !pPlayer->IsClass( TFCLASS_UNDECIDED ) && pPlayer->IsAlive() && pPlayer->InSameTeam( m_pPlayer ) == false )
{
Boot( pPlayer );
m_flNextBootCheck = gpGlobals->curtime + 1.5;
}
}
}
}
BaseClass::ClassThink();
}
示例2: ShieldBash
//-----------------------------------------------------------------------------
// Purpose: Bash enemies in front of me with my shield
//-----------------------------------------------------------------------------
void CWeaponCombatShield::ShieldBash( void )
{
#if 0
// ROBIN: Disabled shield bash
return;
// Get any players in front of me
CBaseTFPlayer *pOwner = ToBaseTFPlayer( GetOwner() );
if ( !pOwner )
return;
// Get the target point and location
Vector vecAiming;
Vector vecSrc = pOwner->Weapon_ShootPosition( pOwner->GetOrigin() );
pOwner->EyeVectors( &vecAiming );
// Find a player in range of this player, and make sure they're healable
trace_t tr;
Vector vecEnd = vecSrc + (vecAiming * SHIELD_BASH_RANGE);
UTIL_TraceLine( vecSrc, vecEnd, MASK_SHOT, pOwner->edict(), COLLISION_GROUP_NONE, &tr);
if (tr.fraction != 1.0)
{
CBaseEntity *pEntity = CBaseEntity::Instance(tr.u.ent);
if ( pEntity )
{
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( pEntity );
if ( pPlayer && (pPlayer != pOwner) )
{
// Target needs to be on the eneny team
if ( pPlayer->IsAlive() && !pPlayer->InSameTeam( pOwner ) )
{
// Ok, we have an enemy player
pPlayer->TakeShieldBash( pOwner );
}
}
}
}
#endif
}