本文整理汇总了C++中CTFPlayer::IsPlayerDead方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFPlayer::IsPlayerDead方法的具体用法?C++ CTFPlayer::IsPlayerDead怎么用?C++ CTFPlayer::IsPlayerDead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFPlayer
的用法示例。
在下文中一共展示了CTFPlayer::IsPlayerDead方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClientThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponMedigun::ClientThink()
{
C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( !pLocalPlayer )
return;
// Don't show it while the player is dead. Ideally, we'd respond to m_bHealing in OnDataChanged,
// but it stops sending the weapon when it's holstered, and it gets holstered when the player dies.
CTFPlayer *pFiringPlayer = ToTFPlayer( GetOwnerEntity() );
if ( !pFiringPlayer || pFiringPlayer->IsPlayerDead() || pFiringPlayer->IsDormant() )
{
ClientThinkList()->SetNextClientThink( GetClientHandle(), CLIENT_THINK_NEVER );
m_bPlayingSound = false;
StopHealSound();
return;
}
// If the local player is the guy getting healed, let him know
// who's healing him, and their charge level.
if( m_hHealingTarget != NULL )
{
if ( pLocalPlayer == m_hHealingTarget )
{
pLocalPlayer->SetHealer( pFiringPlayer, m_flChargeLevel );
}
if ( !m_bPlayingSound )
{
m_bPlayingSound = true;
CLocalPlayerFilter filter;
EmitSound( filter, entindex(), "WeaponMedigun.Healing" );
}
}
if ( m_bOldChargeRelease != m_bChargeRelease )
{
m_bOldChargeRelease = m_bChargeRelease;
ForceHealingTargetUpdate();
}
}
示例2: UpdateEffects
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponMedigun::UpdateEffects( void )
{
CTFPlayer *pFiringPlayer = ToTFPlayer( GetOwnerEntity() );
if ( !pFiringPlayer )
return;
C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();
C_BaseEntity *pEffectOwner = this;
if ( pLocalPlayer == pFiringPlayer )
{
pEffectOwner = pLocalPlayer->GetViewModel();
if ( !pEffectOwner )
return;
}
// Remove all the effects
if ( pEffectOwner )
{
pEffectOwner->ParticleProp()->StopEmission( m_hHealingTargetEffect.pEffect );
}
else
{
m_hHealingTargetEffect.pEffect->StopEmission();
}
m_hHealingTargetEffect.pTarget = NULL;
m_hHealingTargetEffect.pEffect = NULL;
// Don't add targets if the medic is dead
if ( !pEffectOwner || pFiringPlayer->IsPlayerDead() || !pFiringPlayer->IsPlayerClass( TF_CLASS_MEDIC ) )
return;
// Add our targets
// Loops through the healing targets, and make sure we have an effect for each of them
if ( m_hHealingTarget )
{
if ( m_hHealingTargetEffect.pTarget == m_hHealingTarget )
return;
const char *pszEffectName;
if (m_bChargeRelease)
{
switch (GetTeamNumber())
{
case TF_TEAM_BLUE:
pszEffectName = "medicgun_beam_blue_invun";
break;
case TF_TEAM_RED:
pszEffectName = "medicgun_beam_red_invun";
break;
case TF_TEAM_GREEN:
pszEffectName = "medicgun_beam_green_invun";
break;
case TF_TEAM_YELLOW:
pszEffectName = "medicgun_beam_yellow_invun";
break;
default:
pszEffectName = "medicgun_beam_blue";
break;
}
}
else
{
switch (GetTeamNumber())
{
case TF_TEAM_BLUE:
pszEffectName = "medicgun_beam_blue";
break;
case TF_TEAM_RED:
pszEffectName = "medicgun_beam_red";
break;
case TF_TEAM_GREEN:
pszEffectName = "medicgun_beam_green";
break;
case TF_TEAM_YELLOW:
pszEffectName = "medicgun_beam_yellow";
break;
default:
pszEffectName = "medicgun_beam_blue";
break;
}
}
CNewParticleEffect *pEffect = pEffectOwner->ParticleProp()->Create( pszEffectName, PATTACH_POINT_FOLLOW, "muzzle" );
pEffectOwner->ParticleProp()->AddControlPoint( pEffect, 1, m_hHealingTarget, PATTACH_ABSORIGIN_FOLLOW, NULL, Vector(0,0,50) );
m_hHealingTargetEffect.pTarget = m_hHealingTarget;
m_hHealingTargetEffect.pEffect = pEffect;
}
}