本文整理汇总了C++中CCharacter::GetBlockWindowOpen方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharacter::GetBlockWindowOpen方法的具体用法?C++ CCharacter::GetBlockWindowOpen怎么用?C++ CCharacter::GetBlockWindowOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharacter
的用法示例。
在下文中一共展示了CCharacter::GetBlockWindowOpen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateSensor
bool CAISensorCounterMelee::UpdateSensor()
{
if ( !super::UpdateSensor() )
{
return false;
}
// Determine if the AI can block at this time.
bool bBlockOpportunity = false;
bool bDodgeOpportunity = false;
if ( m_pAI->HasTarget( kTarget_Character ) )
{
CCharacter* pChar = CCharacter::DynamicCast( m_pAI->GetAIBlackBoard()->GetBBTargetObject() );
if ( pChar )
{
bBlockOpportunity = pChar->GetBlockWindowOpen();
bDodgeOpportunity = pChar->GetDodgeWindowOpen();
}
}
// Enemy just exposed themselves to a counter move.
// Record this in working memory by setting the desire to perform
// a countermelee to 1.0. This ONLY needs to be updated if last frame
// the AI couldn't perform either action, and this frame one is valid.
if ( ( bBlockOpportunity || bDodgeOpportunity )
&& ( !m_bBlockOpportunity || !m_bDodgeOpportunity ) )
{
CAIWMFact queryFact;
queryFact.SetFactType( kFact_Desire );
queryFact.SetDesireType( kDesire_CounterMelee );
CAIWMFact* pFact = m_pAI->GetAIWorkingMemory()->FindWMFact( queryFact );
if ( !pFact )
{
pFact = m_pAI->GetAIWorkingMemory()->CreateWMFact( kFact_Desire );
pFact->SetDesireType( kDesire_CounterMelee );
}
if ( pFact )
{
pFact->SetSourceObject( m_pAI->GetAIBlackBoard()->GetBBTargetObject() );
pFact->SetConfidence( CAIWMFact::kFactMask_DesireType, 1.0f );
pFact->SetTime( g_pLTServer->GetTime() );
}
}
// Select a new action if a new type of opportunity has opened this update.
// This needs to happen any time an opportunity opens up; otherwise,
if ( bBlockOpportunity && !m_bBlockOpportunity
|| bDodgeOpportunity && !m_bDodgeOpportunity )
{
m_pAI->GetAIBlackBoard()->SetBBSelectAction( true );
}
// The window to start a block has elapsed. Clear the desire to perform
// a countermelee move.
if ( !bBlockOpportunity && m_bBlockOpportunity
|| !bDodgeOpportunity && m_bDodgeOpportunity )
{
CAIWMFact queryFact;
queryFact.SetFactType( kFact_Desire );
queryFact.SetDesireType( kDesire_CounterMelee );
CAIWMFact* pFact = m_pAI->GetAIWorkingMemory()->FindWMFact( queryFact );
if ( pFact )
{
pFact->SetConfidence( CAIWMFact::kFactMask_DesireType, 0.0f );
}
}
// Update the update history tracking state.
m_bBlockOpportunity = bBlockOpportunity;
m_bDodgeOpportunity = bDodgeOpportunity;
// Sensor did not perform any significant work. Do not block sensor updating.
return false;
}