本文整理汇总了C++中EHANDLE::IsPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ EHANDLE::IsPlayer方法的具体用法?C++ EHANDLE::IsPlayer怎么用?C++ EHANDLE::IsPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EHANDLE
的用法示例。
在下文中一共展示了EHANDLE::IsPlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunTask
//---------------------------------------------------------
//---------------------------------------------------------
void CNPC_Combine_Cannon::RunTask( const Task_t *pTask )
{
switch( pTask->iTask )
{
case TASK_CANNON_ATTACK_CURSOR:
if( FireBullet( m_vecPaintCursor, true ) )
{
TaskComplete();
}
break;
case TASK_RANGE_ATTACK1:
{
// Where we're focusing our fire
Vector vecTarget = ( m_hBarrageTarget == NULL ) ? m_vecPaintCursor : LeadTarget( m_hBarrageTarget );
// Fire at enemy
if ( FireBullet( vecTarget, true ) )
{
bool bPlayerIsEnemy = ( m_hBarrageTarget && m_hBarrageTarget->IsPlayer() );
bool bBarrageFinished = m_flBarrageDuration < gpGlobals->curtime;
bool bNoShot = ( QuerySeeEntity( m_hBarrageTarget ) == false ); // FIXME: Store this info off better
bool bSeePlayer = HasCondition( COND_SEE_PLAYER );
// Treat the player differently to normal NPCs
if ( bPlayerIsEnemy )
{
// Store the last time we shot for doing an abbreviated attack telegraph
m_flTimeLastAttackedPlayer = gpGlobals->curtime;
// If we've got no shot and we're done with our current barrage
if ( bNoShot && bBarrageFinished )
{
TaskComplete();
}
}
else if ( bBarrageFinished || bSeePlayer )
{
// Done with the barrage or we saw the player as a better target
TaskComplete();
}
}
}
break;
case TASK_CANNON_PAINT_ENEMY:
{
// See if we're done painting our target
if ( IsWaitFinished() )
{
TaskComplete();
}
// Continue to paint the target
PaintTarget( LeadTarget( GetEnemy() ), m_flPaintTime );
}
break;
default:
BaseClass::RunTask( pTask );
break;
}
}
示例2: ThrowObject
void CNPC_Dog::ThrowObject( const char *pAttachmentName )
{
if ( m_hPhysicsEnt )
{
m_bHasObject = false;
IPhysicsObject *pPhysObj = m_hPhysicsEnt->VPhysicsGetObject();
if ( pPhysObj )
{
Vector vGunPos;
QAngle angGunAngles;
AngularImpulse angVelocity = RandomAngularImpulse( -250 , -250 ) / pPhysObj->GetMass();
InvalidateBoneCache();
int iAttachment = LookupAttachment( pAttachmentName );
if ( iAttachment == 0 )
iAttachment = m_iPhysGunAttachment;
GetAttachment( iAttachment, vGunPos, angGunAngles );
pPhysObj->Wake();
if ( pPhysObj->GetShadowController() )
{
m_hPhysicsEnt->SetParent( NULL );
m_hPhysicsEnt->SetMoveType( (MoveType_t)m_iContainerMoveType );
m_hPhysicsEnt->SetOwnerEntity( this );
pPhysObj->RemoveShadowController();
pPhysObj->SetPosition( m_hPhysicsEnt->GetLocalOrigin(), m_hPhysicsEnt->GetLocalAngles(), true );
pPhysObj->RecheckCollisionFilter();
pPhysObj->RecheckContactPoints();
}
if ( m_hThrowTarget == NULL )
#ifdef SecobMod__Enable_Fixed_Multiplayer_AI
m_hThrowTarget = UTIL_GetNearestVisiblePlayer(this);
#else
m_hThrowTarget = AI_GetSinglePlayer();
#endif //SecobMod__Enable_Fixed_Multiplayer_AI
Vector vThrowDirection;
if ( m_hThrowTarget )
{
Vector vThrowOrigin = m_hThrowTarget->GetAbsOrigin();
if ( m_hThrowTarget->IsPlayer() )
vThrowOrigin = vThrowOrigin + Vector( random->RandomFloat( -128, 128 ), random->RandomFloat( -128, 128 ), 0 );
Vector vecToss = VecCheckToss( this, vGunPos, vThrowOrigin, m_flThrowArcModifier, 1.0f, true );
if( vecToss == vec3_origin )
{
// Fix up an impossible throw so dog will at least toss the box in the target's general direction instead of dropping it.
// Also toss it up in the air so it will fall down and break. (Just throw the box up at a 45 degree angle)
Vector forward, up;
GetVectors( &forward, NULL, &up );
vecToss = forward + up;
VectorNormalize( vecToss );
vecToss *= pPhysObj->GetMass() * 30.0f;
}
vThrowDirection = vecToss + ( m_hThrowTarget->GetSmoothedVelocity() / 2 );
Vector vLinearDrag;
Vector unitVel = vThrowDirection;
VectorNormalize( unitVel );
float flTest = 1000 / vThrowDirection.Length();
float flDrag = pPhysObj->CalculateLinearDrag( vThrowDirection );
vThrowDirection = vThrowDirection + ( unitVel * ( flDrag * flDrag ) ) / flTest;
pPhysObj->SetVelocity( &vThrowDirection, &angVelocity );
m_flTimeToCatch = gpGlobals->curtime + dog_max_wait_time.GetFloat();
//Don't start pulling until the object is away from me.
//We base the time on the throw velocity.
m_flTimeToPull = gpGlobals->curtime + ( 1000 / vThrowDirection.Length() );
}
//Fire Output!
m_OnThrow.FireOutput( this, this );
ClearBeams();
if ( m_bBeamEffects == true )
{
EmitSound( "Weapon_PhysCannon.Launch" );
//.........这里部分代码省略.........