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


C++ CCharacter::GetDestructible方法代码示例

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


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

示例1: IsDeadCharacter

bool IsDeadCharacter(  HOBJECT hObject )
{
	if( !hObject ) return true;

	if( !IsCharacter( hObject ) ) return false;

	CCharacter *pCharacter = (CCharacter*)g_pLTServer->HandleToObject( hObject );
	return ( pCharacter->GetDestructible()->IsDead() );
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:9,代码来源:AIUtils.cpp

示例2: UpdateSensor

bool CAISensorEnemyDamagedSuicide::UpdateSensor()
{
	if( !super::UpdateSensor() )
	{
		return false;
	}

	// AI is not targeting anyone.

	if( !m_pAI->HasTarget( kTarget_Character ) )
	{
		return false;
	}

	// Bail if no target.

	HOBJECT hTarget = m_pAI->GetAIBlackBoard()->GetBBTargetObject();
	CCharacter* pChar = (CCharacter*)g_pLTServer->HandleToObject( hTarget );
	if( !pChar )
	{
		return false;
	}

	// Bail if no destructible.

	CDestructible* pDestructible = pChar->GetDestructible();
	if( !pDestructible )
	{
		return false;
	}

	// Bail if we were not the last damager.

	if( pDestructible->GetLastDamager() != m_pAI->m_hObject )
	{
		return false;
	}

	// No new damage.

	if( pDestructible->GetLastDamageTime() <= 0.f )
	{
		return false;
	}

	// We damaged the target.
	// So kill myself.
	
	g_pCmdMgr->QueueMessage( m_pAI, m_pAI, "DESTROY" );

	return true;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:52,代码来源:AISensorEnemyDamagedSuicide.cpp

示例3: Fire

void CAIWeaponMelee::Fire(CAI* pAI)
{
	if( !m_pWeapon )
	{
		AIASSERT( 0, pAI->GetHOBJECT(), "CAIWeaponMelee::Fire: No weapon!" );
		return;
	}

	if( m_eFiringState != kAIFiringState_Firing )
	{
		return;
	}

	// Fire!

	LTVector vTargetPos;
	bool bHit = GetShootPosition( pAI, m_Context, vTargetPos );
	if (DefaultFire(pAI, vTargetPos, m_pAIWeaponRecord->bAIAnimatesReload))
	{
		// Decrement burst count for this shot.
		m_nBurstShots--;
	}

	// Knock the player back, if the hit inflicted damage.

	if( bHit )
	{
		CPlayerObj* pPlayer = NULL;
		HOBJECT hTarget = pAI->GetAIBlackBoard()->GetBBTargetObject();
		if( IsPlayer( hTarget ) )
		{
			pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject( hTarget );
		}

		if( pPlayer &&
			( m_pAIWeaponRecord->fPlayerPusherRadius > 0.f ) &&
			( m_pAIWeaponRecord->fPlayerPusherForce > 0.f ) &&
			( pPlayer->GetDestructible() ) &&
			( pPlayer->GetDestructible()->GetLastDamageTime() == g_pLTServer->GetTime() ) &&
			( pPlayer->GetDestructible()->GetLastDamager() == pAI->m_hObject ) )
		{
			if( ( pPlayer->GetDestructible()->GetLastArmorAbsorb() > 0.f ) ||
				( pPlayer->GetDestructible()->GetLastDamage() > 0.f ) )
			{
				pPlayer->PushCharacter( pAI->GetPosition(), m_pAIWeaponRecord->fPlayerPusherRadius, 0.f, 0.3f, m_pAIWeaponRecord->fPlayerPusherForce );
			}
		}

		// Only play if we've been targeting someone for at least 5 seconds.
		// This ensures we first play higher priority reaction sounds.

		if( IsCharacter( hTarget ) )
		{
			CCharacter* pChar = (CCharacter*)g_pLTServer->HandleToObject( hTarget );
			if( pChar &&
				( pChar->GetDestructible() ) &&
				( pChar->GetDestructible()->GetLastDamageTime() == g_pLTServer->GetTime() ) &&
				( pChar->GetDestructible()->GetLastDamager() == pAI->m_hObject ) &&
				( pAI->GetAIBlackBoard()->GetBBTargetChangeTime() < g_pLTServer->GetTime() - 5.f ) )
			{
				HOBJECT hAlly = g_pAICoordinator->FindAlly( pAI->m_hObject, hTarget );
				if( hAlly )
				{
					g_pAISoundMgr->RequestAISound( hAlly, kAIS_HitSeenMelee, kAISndCat_Event, hTarget, 0.5f );
				}
			}
		}
	}
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:69,代码来源:AIWeaponMelee.cpp


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