本文整理汇总了C++中C_TFPlayer::GetHealth方法的典型用法代码示例。如果您正苦于以下问题:C++ C_TFPlayer::GetHealth方法的具体用法?C++ C_TFPlayer::GetHealth怎么用?C++ C_TFPlayer::GetHealth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_TFPlayer
的用法示例。
在下文中一共展示了C_TFPlayer::GetHealth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateID
//.........这里部分代码省略.........
wchar_t wszChargeLevel[ 10 ];
_snwprintf( wszChargeLevel, ARRAYSIZE(wszChargeLevel) - 1, L"%.0f", pPlayer->MedicGetChargeLevel() * 100 );
wszChargeLevel[ ARRAYSIZE(wszChargeLevel)-1 ] = '\0';
g_pVGuiLocalize->ConstructString( sDataString, sizeof(sDataString), g_pVGuiLocalize->Find( "#TF_playerid_mediccharge" ), 1, wszChargeLevel );
}
if (pLocalTFPlayer->GetTeamNumber() == TEAM_SPECTATOR || pPlayer->InSameTeam(pLocalTFPlayer) || (bDisguisedEnemy && pPlayer->m_Shared.GetDisguiseTeam() == pLocalTFPlayer->GetTeamNumber()))
{
printFormatString = "#TF_playerid_sameteam";
bShowHealth = true;
}
else if ( pLocalTFPlayer->IsPlayerClass( TF_CLASS_SPY ) && !pPlayer->m_Shared.InCond( TF_COND_STEALTHED ) )
{
// Spy can see enemy's health.
printFormatString = "#TF_playerid_diffteam";
bShowHealth = true;
}
if ( bShowHealth )
{
C_TF_PlayerResource *tf_PR = dynamic_cast<C_TF_PlayerResource *>(g_PR);
if ( tf_PR )
{
flMaxHealth = tf_PR->GetMaxHealth( m_iTargetEntIndex );
iMaxBuffedHealth = pPlayer->m_Shared.GetMaxBuffedHealth();
if ( bDisguisedEnemy )
{
flHealth = (float)pPlayer->m_Shared.GetDisguiseHealth();
}
else
{
flHealth = (float)pPlayer->GetHealth();
}
}
else
{
bShowHealth = false;
}
}
if ( printFormatString )
{
wchar_t *pszPrepend = GetPrepend();
if ( !pszPrepend || !pszPrepend[0] )
{
pszPrepend = L"";
}
g_pVGuiLocalize->ConstructString( sIDString, sizeof(sIDString), g_pVGuiLocalize->Find(printFormatString), 2, pszPrepend, wszPlayerName );
}
}
else
{
// see if it is an object
if ( pEnt->IsBaseObject() )
{
C_BaseObject *pObj = assert_cast<C_BaseObject *>( pEnt );
pObj->GetTargetIDString( sIDString, sizeof(sIDString) );
pObj->GetTargetIDDataString( sDataString, sizeof(sDataString) );
bShowHealth = true;
flHealth = pObj->GetHealth();
flMaxHealth = pObj->GetMaxHealth();
C_TFPlayer *pBuilder = pObj->GetBuilder();
iColorNum = pBuilder ? pBuilder->GetTeamNumber() : pObj->GetTeamNumber();