本文整理汇总了C++中IServerVehicle::ClassifyPassenger方法的典型用法代码示例。如果您正苦于以下问题:C++ IServerVehicle::ClassifyPassenger方法的具体用法?C++ IServerVehicle::ClassifyPassenger怎么用?C++ IServerVehicle::ClassifyPassenger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServerVehicle
的用法示例。
在下文中一共展示了IServerVehicle::ClassifyPassenger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TrackTarget
//.........这里部分代码省略.........
if ( !pEntity || ( pEntity->GetFlags() & FL_NOTARGET ) )
{
m_hTarget = FindTarget( m_targetEntityName, NULL );
if ( IsActive() )
{
SetNextThink( gpGlobals->curtime + 2 ); // Wait 2 sec s
}
return;
}
pTarget = pEntity;
// Calculate angle needed to aim at target
worldTargetPosition = pEntity->EyePosition();
float range = (worldTargetPosition - barrelEnd).Length();
if ( !InRange( range ) )
{
m_bFireDelayed = false;
return;
}
UTIL_TraceLine( barrelEnd, worldTargetPosition, MASK_BLOCKLOS, this, COLLISION_GROUP_NONE, &tr );
lineOfSight = FALSE;
// No line of sight, don't track
if ( tr.fraction == 1.0 || tr.m_pEnt == pTarget )
{
lineOfSight = TRUE;
CBaseEntity *pInstance = pTarget;
if ( InRange( range ) && pInstance && pInstance->IsAlive() )
{
updateTime = TRUE;
// Sight position is BodyTarget with no noise (so gun doesn't bob up and down)
m_sightOrigin = pInstance->BodyTarget( GetLocalOrigin(), false );
}
}
// Convert targetPosition to parent
angles = AimBarrelAt( m_parentMatrix.WorldToLocal( m_sightOrigin ) );
// Force the angles to be relative to the center position
float offsetY = UTIL_AngleDistance( angles.y, m_yawCenter );
float offsetX = UTIL_AngleDistance( angles.x, m_pitchCenter );
angles.y = m_yawCenter + offsetY;
angles.x = m_pitchCenter + offsetX;
// Move toward target at rate or less
float distY = UTIL_AngleDistance( angles.y, GetLocalAngles().y );
QAngle vecAngVel = GetLocalAngularVelocity();
vecAngVel.y = distY * 10;
vecAngVel.y = clamp( vecAngVel.y, -m_yawRate, m_yawRate );
// Move toward target at rate or less
float distX = UTIL_AngleDistance( angles.x, GetLocalAngles().x );
vecAngVel.x = distX * 10;
vecAngVel.x = clamp( vecAngVel.x, -m_pitchRate, m_pitchRate );
SetLocalAngularVelocity( vecAngVel );
SetMoveDoneTime( 0.1 );
Vector forward;
AngleVectors( GetLocalAngles(), &forward );
forward = m_parentMatrix.ApplyRotation( forward );
AngleVectors(angles, &forward);
if ( lineOfSight == TRUE )
{
// FIXME: This will ultimately have to deal with NPCs being in the vehicle as well
// See if the target is in a vehicle. If so, check its relationship
CBasePlayer *pPlayer = ToBasePlayer( pTarget );
if ( pPlayer && pPlayer->IsInAVehicle() )
{
IServerVehicle *pVehicle = pPlayer->GetVehicle();
if ( pVehicle->ClassifyPassenger( pPlayer, CLASS_PLAYER ) == CLASS_PLAYER)
{
if ( !m_bFireDelayed )
{
m_bFireDelayed = true;
m_flFiringDelay = gpGlobals->curtime + 1.5; // setup delay time before we start firing
return;
}
if ( gpGlobals->curtime > m_flFiringDelay )
{
m_OnFireAtTarget.Set(forward, this, this); // tell apc to fire rockets, and what direction
}
}
}
}
else
{
m_bFireDelayed = false; // reset flag since we can no longer see target
}
}