本文整理汇总了C++中CAI::GetAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI::GetAlignment方法的具体用法?C++ CAI::GetAlignment怎么用?C++ CAI::GetAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI
的用法示例。
在下文中一共展示了CAI::GetAlignment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectDisturbanceSource
HOBJECT CAITargetSelectDisturbanceBeyondGuard::SelectDisturbanceSource( CAI* pAI, CAIWMFact* pFact )
{
// Sanity check.
if( !( pAI && pFact ) )
{
return NULL;
}
// Disturbance is not from an AI.
if( !IsAI( pFact->GetTargetObject() ) )
{
return pFact->GetTargetObject();
}
// AI is not an ally.
CAI* pOther = (CAI*)g_pLTServer->HandleToObject( pFact->GetTargetObject() );
EnumCharacterStance eStance = g_pCharacterDB->GetStance( pAI->GetAlignment(), pOther->GetAlignment() );
if( eStance != kCharStance_Like )
{
return pFact->GetTargetObject();
}
// Ally is not targeting a character.
if( pOther->GetAIBlackBoard()->GetBBTargetType() != kTarget_Character )
{
return pFact->GetTargetObject();
}
// Return the Ally's target object.
return pOther->GetAIBlackBoard()->GetBBTargetObject();
}
示例2: TargetDisturbance
void CAITargetSelectDisturbance::TargetDisturbance( CAI* pAI, CAIWMFact* pFact )
{
// Sanity check.
if( !( pAI && pFact ) )
{
return;
}
// Record the existence of a disturbance in the AI's world state.
pAI->GetAIWorldState()->SetWSProp( kWSK_DisturbanceExists, pAI->m_hObject, kWST_bool, true );
// Play a sound corresponding to the type of stimulus.
EnumAIStimulusID eStimulusID;
EnumAIStimulusType eStimulusType;
pFact->GetStimulus( &eStimulusType, &eStimulusID );
switch( eStimulusType )
{
case kStim_WeaponFireSound:
case kStim_WeaponImpactSound:
case kStim_WeaponReloadSound:
case kStim_DisturbanceSound:
case kStim_FootstepSound:
case kStim_DeathSound:
case kStim_PainSound:
{
HOBJECT hAlly = g_pAICoordinator->FindAlly( pAI->m_hObject, NULL );
if( hAlly )
{
// "Check it out!"
// "Roger!"
g_pAISoundMgr->RequestAISound( pAI->m_hObject, kAIS_OrderInvestigate, kAISndCat_DisturbanceHeard, NULL, 1.f );
g_pAISoundMgr->RequestAISoundSequence( hAlly, kAIS_Affirmative, pAI->m_hObject, kAIS_OrderInvestigate, kAIS_OrderInvestigate, kAISndCat_Event, NULL, 0.3f );
}
else {
// "What was that?"
g_pAISoundMgr->RequestAISound( pAI->m_hObject, kAIS_DisturbanceHeardAlarming, kAISndCat_DisturbanceHeard, NULL, 1.f );
}
}
break;
// "Flashlight!"
case kStim_FlashlightBeamVisible:
{
g_pAISoundMgr->RequestAISound( pAI->m_hObject, kAIS_DisturbanceSeenFlashlight, kAISndCat_Event, NULL, 0.5f );
HOBJECT hAlly = g_pAICoordinator->FindAlly( pAI->m_hObject, NULL );
if( hAlly )
{
// "Check it out!"
// "Roger!"
g_pAISoundMgr->RequestAISoundSequence( hAlly, kAIS_OrderInvestigate, pAI->m_hObject, kAIS_DisturbanceSeenFlashlight, kAIS_DisturbanceSeenFlashlight, kAISndCat_DisturbanceHeard, NULL, 0.3f );
g_pAISoundMgr->RequestAISoundSequence( pAI->m_hObject, kAIS_Affirmative, hAlly, kAIS_OrderInvestigate, kAIS_DisturbanceSeenFlashlight, kAISndCat_Event, NULL, 0.3f );
}
}
break;
}
// Record new target on the BlackBoard.
pAI->GetAIBlackBoard()->SetBBTargetType( kTarget_Disturbance );
pAI->GetAIBlackBoard()->SetBBTargetStimulusType( eStimulusType );
pAI->GetAIBlackBoard()->SetBBTargetStimulusID( eStimulusID );
pAI->GetAIBlackBoard()->SetBBTargetChangeTime( g_pLTServer->GetTime() );
pAI->GetAIBlackBoard()->SetBBTargetObject( pFact->GetTargetObject() );
// Record initial disturbance position.
// If the stimulus is dynamic, AITarget will track its movement.
LTVector vTargetPos = pFact->GetPos();
pAI->GetAIBlackBoard()->SetBBTargetPosition( vTargetPos );
// If the disturbance is coming from an ally's weapon fire sound,
// then treat the disturbance position as the position of whatever
// the ally is firing at.
if( IsAI( pFact->GetTargetObject() ) )
{
CAI* pOtherAI = (CAI*)g_pLTServer->HandleToObject( pFact->GetTargetObject() );
if( pOtherAI &&
pOtherAI->HasTarget( kTarget_Character ) &&
( eStimulusType == kStim_WeaponFireSound ) &&
( kCharStance_Like == g_pCharacterDB->GetStance( pAI->GetAlignment(), pOtherAI->GetAlignment() ) ) )
{
LTVector vTargetPos = pOtherAI->GetAIBlackBoard()->GetBBTargetPosition();
pAI->GetAIBlackBoard()->SetBBTargetPosition( vTargetPos );
pFact->SetPos( vTargetPos, 1.f );
}
}
}