本文整理汇总了C++中C_BaseObject::GetBuildingAlertLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseObject::GetBuildingAlertLevel方法的具体用法?C++ C_BaseObject::GetBuildingAlertLevel怎么用?C++ C_BaseObject::GetBuildingAlertLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseObject
的用法示例。
在下文中一共展示了C_BaseObject::GetBuildingAlertLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecalculateAlertState
void CHudBuildingStatusContainer::RecalculateAlertState( void )
{
BuildingHudAlert_t maxAlertLevel = BUILDING_HUD_ALERT_NONE;
// find our highest warning level
for ( int i = 0; i < m_BuildingPanels.Count(); i++ )
{
CBuildingStatusItem *pItem = m_BuildingPanels.Element(i);
C_BaseObject * pObj = pItem->GetRepresentativeObject();
if ( pObj )
{
BuildingHudAlert_t alertLevel = pObj->GetBuildingAlertLevel();
if ( alertLevel > maxAlertLevel )
{
maxAlertLevel = alertLevel;
}
}
}
if ( maxAlertLevel != m_AlertLevel )
{
if ( maxAlertLevel >= BUILDING_HUD_ALERT_VERY_LOW_AMMO )
{
m_flNextBeep = gpGlobals->curtime; // beep asap
m_iNumBeepsToBeep = tf_hud_num_building_alert_beeps.GetInt();
}
m_AlertLevel = maxAlertLevel;
}
}
示例2: OnTick
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBuildingStatusItem::OnTick()
{
// We only tick while active and with a valid built object
C_BaseObject *pObj = GetRepresentativeObject();
if ( !pObj ) // implies not active
{
if ( m_bActive )
{
// we lost our object. force relayout to inactive mode
InvalidateLayout();
// tell our parent that we're gone
IGameEvent *event = gameeventmanager->CreateEvent( "building_info_changed" );
if ( event )
{
event->SetInt( "building_type", GetRepresentativeObjectType() );
gameeventmanager->FireEventClientSide( event );
}
}
// We don't want to tick while inactive regardless
return;
}
float flHealth = (float)pObj->GetHealth() / (float)pObj->GetMaxHealth();
m_pHealthBar->SetProgress( flHealth );
if ( pObj->IsBuilding() )
{
m_pBuildingPanel->SetVisible( true );
m_pRunningPanel->SetVisible( false );
m_pBuildingProgress->SetProgress( pObj->GetPercentageConstructed() );
}
else
{
m_pBuildingPanel->SetVisible( false );
m_pRunningPanel->SetVisible( true );
}
// what is our current alert state?
BuildingHudAlert_t alertLevel = pObj->GetBuildingAlertLevel();
if ( alertLevel <= BUILDING_HUD_ALERT_NONE )
{
// if the tray is out, hide it
if ( m_pAlertTray->IsTrayOut() )
{
m_pAlertTray->HideTray();
m_pWrenchIcon->SetVisible( false );
m_pSapperIcon->SetVisible( false );
}
}
else
{
if ( !m_pAlertTray->IsTrayOut() )
{
m_pAlertTray->ShowTray();
}
m_pAlertTray->SetAlertType( alertLevel );
m_pWrenchIcon->SetVisible( false );
m_pSapperIcon->SetVisible( false );
if ( m_pAlertTray->GetAlertType() != BUILDING_HUD_ALERT_NONE &&
m_pAlertTray->GetPercentDeployed() >= 1.0f )
{
switch( m_pAlertTray->GetAlertType() )
{
case BUILDING_HUD_ALERT_LOW_AMMO:
case BUILDING_HUD_ALERT_LOW_HEALTH:
case BUILDING_HUD_ALERT_VERY_LOW_AMMO:
case BUILDING_HUD_ALERT_VERY_LOW_HEALTH:
m_pWrenchIcon->SetVisible( true );
break;
case BUILDING_HUD_ALERT_SAPPER:
m_pSapperIcon->SetVisible( true );
break;
case BUILDING_HUD_ALERT_NONE:
default:
break;
}
}
}
}