本文整理汇总了C++中C_BaseObject::IsHostileUpgrade方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseObject::IsHostileUpgrade方法的具体用法?C++ C_BaseObject::IsHostileUpgrade怎么用?C++ C_BaseObject::IsHostileUpgrade使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseObject
的用法示例。
在下文中一共展示了C_BaseObject::IsHostileUpgrade方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HighlightBuildPoints
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_BaseObject::HighlightBuildPoints( int flags )
{
C_TFPlayer *pLocal = C_TFPlayer::GetLocalTFPlayer();
if ( !pLocal )
return;
if ( !GetNumBuildPoints() || !InLocalTeam() )
return;
C_TFWeaponBuilder *pBuilderWpn = dynamic_cast< C_TFWeaponBuilder * >( pLocal->GetActiveWeaponForSelection() );
if ( !pBuilderWpn )
return;
if ( !pBuilderWpn->IsPlacingObject() )
return;
C_BaseObject *pPlacementObj = pBuilderWpn->GetPlacementModel();
if ( !pPlacementObj || pPlacementObj == this )
return;
// Near enough?
if ( (GetAbsOrigin() - pLocal->GetAbsOrigin()).LengthSqr() < MAX_VISIBLE_BUILDPOINT_DISTANCE )
{
bool bRestoreModel = false;
Vector vecPrevAbsOrigin = pPlacementObj->GetAbsOrigin();
QAngle vecPrevAbsAngles = pPlacementObj->GetAbsAngles();
Vector orgColor;
render->GetColorModulation( orgColor.Base() );
float orgBlend = render->GetBlend();
bool bSameTeam = ( pPlacementObj->GetTeamNumber() == GetTeamNumber() );
if ( pPlacementObj->IsHostileUpgrade() && bSameTeam )
{
// Don't hilight hostile upgrades on friendly objects
return;
}
else if ( !bSameTeam )
{
// Don't hilight upgrades on enemy objects
return;
}
// Any empty buildpoints?
for ( int i = 0; i < GetNumBuildPoints(); i++ )
{
// Can this object build on this point?
if ( CanBuildObjectOnBuildPoint( i, pPlacementObj->GetType() ) )
{
Vector vecBPOrigin;
QAngle vecBPAngles;
if ( GetBuildPoint(i, vecBPOrigin, vecBPAngles) )
{
pPlacementObj->InvalidateBoneCaches();
Vector color( 0, 255, 0 );
render->SetColorModulation( color.Base() );
float frac = fmod( gpGlobals->curtime, 3 );
frac *= 2 * M_PI;
frac = cos( frac );
render->SetBlend( (175 + (int)( frac * 75.0f )) / 255.0 );
// FIXME: This truly sucks! The bone cache should use
// render location for this computation instead of directly accessing AbsAngles
// Necessary for bone cache computations to work
pPlacementObj->SetAbsOrigin( vecBPOrigin );
pPlacementObj->SetAbsAngles( vecBPAngles );
modelrender->DrawModel(
flags,
pPlacementObj,
pPlacementObj->GetModelInstance(),
pPlacementObj->index,
pPlacementObj->GetModel(),
vecBPOrigin,
vecBPAngles,
pPlacementObj->m_nSkin,
pPlacementObj->m_nBody,
pPlacementObj->m_nHitboxSet
);
bRestoreModel = true;
}
}
}
if ( bRestoreModel )
{
pPlacementObj->SetAbsOrigin(vecPrevAbsOrigin);
pPlacementObj->SetAbsAngles(vecPrevAbsAngles);
pPlacementObj->InvalidateBoneCaches();
render->SetColorModulation( orgColor.Base() );
render->SetBlend( orgBlend );
}
}
}