コード例 #1
0
void CAI_PlayerAlly::OnChangeRunningBehavior( CAI_BehaviorBase *pOldBehavior,  CAI_BehaviorBase *pNewBehavior )
{
	BaseClass::OnChangeRunningBehavior( pOldBehavior,  pNewBehavior );
	CAI_FollowBehavior *pFollowBehavior;
	if ( dynamic_cast<CAI_FollowBehavior *>(pNewBehavior) != NULL )
	{
		GetExpresser()->SetSpokeConcept( TLK_HELLO, NULL );	// Don't say hi after you've started following
		if ( IsOkToCombatSpeak() )
			Speak( TLK_USE );
		SetSpeechTarget( GetTarget() );
		ClearCondition( COND_PLAYER_PUSHING );
	}
	else if ( ( pFollowBehavior = dynamic_cast<CAI_FollowBehavior *>(pOldBehavior) ) != NULL  )
	{
		if ( !(m_afMemory & bits_MEMORY_PROVOKED) )
		{
			if ( IsOkToCombatSpeak() )
			{
				if ( pFollowBehavior->GetFollowTarget() == NULL )
					Speak( TLK_UNUSE );
				else
					Speak( TLK_STOP );
			}
			SetSpeechTarget( FindNearestFriend(true) );
		}
	}
}
コード例 #2
0
void CAI_FollowGoal::DisableGoal( CAI_BaseNPC *pAI  )
{ 
	CAI_FollowBehavior *pBehavior;
	if ( !pAI->GetBehavior( &pBehavior ) )
		return;
	
	pBehavior->SetFollowTarget( NULL );
}
コード例 #3
0
ファイル: npc_talker.cpp プロジェクト: Denzeriko/hl2-mod
void CNPCSimpleTalker::OnChangeRunningBehavior( CAI_BehaviorBase *pOldBehavior,  CAI_BehaviorBase *pNewBehavior )
{
	BaseClass::OnChangeRunningBehavior( pOldBehavior,  pNewBehavior );

	CAI_FollowBehavior *pFollowBehavior;
	if ( ( pFollowBehavior = dynamic_cast<CAI_FollowBehavior *>(pNewBehavior) ) != NULL  )
	{
		OnStartingFollow( pFollowBehavior->GetFollowTarget() );
	}
	else if ( ( pFollowBehavior = dynamic_cast<CAI_FollowBehavior *>(pOldBehavior) ) != NULL  )
	{
		OnStoppingFollow( pFollowBehavior->GetFollowTarget() );
	}
}
コード例 #4
0
void CAI_FollowGoal::EnableGoal( CAI_BaseNPC *pAI )
{
	CAI_FollowBehavior *pBehavior;
	if ( !pAI->GetBehavior( &pBehavior ) )
		return;
	
	CBaseEntity *pGoalEntity = GetGoalEntity();
	if ( !pGoalEntity )
	{
		if ( pAI->IRelationType(UTIL_PlayerByIndex( 1 )) == D_LI )
			pBehavior->SetFollowTarget( UTIL_PlayerByIndex( 1 ) );
	}
	else
	{
		pBehavior->SetFollowTarget( pGoalEntity );
	}
}