当前位置: 首页>>代码示例>>C++>>正文


C++ CAI_BaseNPC::FInViewCone方法代码示例

本文整理汇总了C++中CAI_BaseNPC::FInViewCone方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::FInViewCone方法的具体用法?C++ CAI_BaseNPC::FInViewCone怎么用?C++ CAI_BaseNPC::FInViewCone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAI_BaseNPC的用法示例。


在下文中一共展示了CAI_BaseNPC::FInViewCone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:EspyEspurr,项目名称:game,代码行数:45,代码来源:ai_scriptconditions.cpp

示例2: 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;
}
开发者ID:Black-Stormy,项目名称:DoubleAction,代码行数:39,代码来源:ai_behavior_operator.cpp


注:本文中的CAI_BaseNPC::FInViewCone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。