本文整理汇总了C++中CAI_BaseNPC::QuerySeeEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::QuerySeeEntity方法的具体用法?C++ CAI_BaseNPC::QuerySeeEntity怎么用?C++ CAI_BaseNPC::QuerySeeEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::QuerySeeEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanSeePositionEntity
bool CAI_OperatorBehavior::CanSeePositionEntity()
{
CAI_BaseNPC *pOuter = GetOuter();
Assert( m_hPositionEnt.Get() != NULL );
// early out here.
if( !pOuter->QuerySeeEntity(m_hPositionEnt) )
{
m_WatchSeeEntity.Stop();
return false;
}
bool bSpotted = (pOuter->EyePosition().DistToSqr(m_hPositionEnt->GetAbsOrigin()) <= POSITION_ENT_ALWAYS_SEE_DIST);
if ( !bSpotted )
{
bSpotted = ( pOuter->FInViewCone(m_hPositionEnt) && pOuter->FVisible(m_hPositionEnt) );
}
if (bSpotted )
{
// If we haven't seen it up until now, start a timer. If we have seen it, wait for the
// timer to finish. This prevents edge cases where turning on the flashlight makes
// NPC spot the position entity a frame before she spots an enemy.
if ( !m_WatchSeeEntity.IsRunning() )
{
m_WatchSeeEntity.Start( 0.3,0.31 );
return false;
}
if ( !m_WatchSeeEntity.Expired() )
return false;
return true;
}
m_WatchSeeEntity.Stop();
return false;
}
示例2: EvalActorSeeTarget
bool CAI_ScriptConditions::EvalActorSeeTarget( const EvalArgs_t &args )
{
if( m_fActorSeeTarget == TRS_NONE )
{
// Don't care, so don't do any work.
return true;
}
if ( args.pTarget )
{
if ( !args.pActor )
return true;
CAI_BaseNPC *pNPCActor = args.pActor->MyNPCPointer();
#ifdef HL2_EPISODIC
// This is the code we want to have written for HL2, but HL2 shipped without the QuerySeeEntity() call. This #ifdef really wants to be
// something like #ifndef HL2_RETAIL, since this change does want to be in any products that are built henceforth. (sjb)
bool fSee = pNPCActor->FInViewCone( args.pTarget ) && pNPCActor->FVisible( args.pTarget ) && pNPCActor->QuerySeeEntity( args.pTarget );
#else
bool fSee = pNPCActor->FInViewCone( args.pTarget ) && pNPCActor->FVisible( args.pTarget );
#endif//HL2_EPISODIC
if( fSee )
{
if( m_fActorSeeTarget == TRS_TRUE )
{
return true;
}
return false;
}
else
{
if( m_fActorSeeTarget == TRS_FALSE )
{
return true;
}
return false;
}
}
return true;
}