本文整理汇总了C++中CEntityAlive::GetfHealth方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntityAlive::GetfHealth方法的具体用法?C++ CEntityAlive::GetfHealth怎么用?C++ CEntityAlive::GetfHealth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntityAlive
的用法示例。
在下文中一共展示了CEntityAlive::GetfHealth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void CHUDTarget::Render()
{
VERIFY (g_bRendering);
CObject* O = Level().CurrentEntity();
if (0==O) return;
CEntity* E = smart_cast<CEntity*>(O);
if (0==E) return;
Fvector p1 = Device.vCameraPosition;
Fvector dir = Device.vCameraDirection;
// Render cursor
u32 C = C_DEFAULT;
FVF::TL PT;
Fvector p2;
p2.mad (p1,dir,RQ.range);
PT.transform (p2,Device.mFullTransform);
float di_size = C_SIZE/powf(PT.p.w,.2f);
CGameFont* F = HUD().Font().pFontGraffiti19Russian;
F->SetAligment (CGameFont::alCenter);
F->OutSetI (0.f,0.05f);
if (psHUD_Flags.test(HUD_CROSSHAIR_DIST)){
F->SetColor (C);
F->OutNext ("%4.1f",RQ.range);
}
if (psHUD_Flags.test(HUD_INFO)){
if (RQ.O){
CEntityAlive* E = smart_cast<CEntityAlive*> (RQ.O);
CEntityAlive* pCurEnt = smart_cast<CEntityAlive*> (Level().CurrentEntity());
PIItem l_pI = smart_cast<PIItem> (RQ.O);
if (IsGameTypeSingle())
{
CInventoryOwner* our_inv_owner = smart_cast<CInventoryOwner*>(pCurEnt);
if (E && E->g_Alive() && !E->cast_base_monster())
{
//. CInventoryOwner* our_inv_owner = smart_cast<CInventoryOwner*>(pCurEnt);
CInventoryOwner* others_inv_owner = smart_cast<CInventoryOwner*>(E);
if(our_inv_owner && others_inv_owner){
switch(RELATION_REGISTRY().GetRelationType(others_inv_owner, our_inv_owner))
{
case ALife::eRelationTypeEnemy:
C = C_ON_ENEMY; break;
case ALife::eRelationTypeNeutral:
C = C_ON_NEUTRAL; break;
case ALife::eRelationTypeFriend:
C = C_ON_FRIEND; break;
}
if (fuzzyShowInfo>0.5f){
CStringTable strtbl ;
F->SetColor (subst_alpha(C,u8(iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f))));
F->OutNext ("%s", *strtbl.translate(others_inv_owner->Name()) );
F->OutNext ("%s", *strtbl.translate(others_inv_owner->CharacterInfo().Community().id()) );
}
}
fuzzyShowInfo += SHOW_INFO_SPEED*Device.fTimeDelta;
}
else
if (l_pI && our_inv_owner && RQ.range < 2.0f*our_inv_owner->inventory().GetTakeDist())
{
if (fuzzyShowInfo>0.5f){
F->SetColor (subst_alpha(C,u8(iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f))));
F->OutNext ("%s",l_pI->Name/*Complex*/());
}
fuzzyShowInfo += SHOW_INFO_SPEED*Device.fTimeDelta;
}
}
else
{
if (E && (E->GetfHealth()>0))
{
if (pCurEnt && GameID() == GAME_SINGLE){
if (GameID() == GAME_DEATHMATCH) C = C_ON_ENEMY;
else{
if (E->g_Team() != pCurEnt->g_Team()) C = C_ON_ENEMY;
else C = C_ON_FRIEND;
};
if (RQ.range >= recon_mindist() && RQ.range <= recon_maxdist()){
float ddist = (RQ.range - recon_mindist())/(recon_maxdist() - recon_mindist());
float dspeed = recon_minspeed() + (recon_maxspeed() - recon_minspeed())*ddist;
fuzzyShowInfo += Device.fTimeDelta/dspeed;
}else{
if (RQ.range < recon_mindist()) fuzzyShowInfo += recon_minspeed()*Device.fTimeDelta;
else fuzzyShowInfo = 0;
};
if (fuzzyShowInfo>0.5f){
clamp(fuzzyShowInfo,0.f,1.f);
int alpha_C = iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f);
u8 alpha_b = u8(alpha_C & 0x00ff);
F->SetColor (subst_alpha(C,alpha_b));
//.........这里部分代码省略.........