本文整理汇总了C++中CBaseCombatCharacter::CanBecomeRagdoll方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatCharacter::CanBecomeRagdoll方法的具体用法?C++ CBaseCombatCharacter::CanBecomeRagdoll怎么用?C++ CBaseCombatCharacter::CanBecomeRagdoll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatCharacter
的用法示例。
在下文中一共展示了CBaseCombatCharacter::CanBecomeRagdoll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KillNPCInRange
//-----------------------------------------------------------------------------
// Purpose: Attempts to kill an NPC if it's within range and other criteria
// Input : *pVictim - NPC to assess
// **pPhysObj - pointer to the ragdoll created if the NPC is killed
// Output : bool - whether or not the NPC was killed and the returned pointer is valid
//-----------------------------------------------------------------------------
bool CGravityVortexController::KillNPCInRange( CBaseEntity *pVictim, IPhysicsObject **pPhysObj )
{
CBaseCombatCharacter *pBCC = pVictim->MyCombatCharacterPointer();
// See if we can ragdoll
if ( pBCC != NULL && pBCC->CanBecomeRagdoll() )
{
// Don't bother with striders
if ( FClassnameIs( pBCC, "npc_strider" ) )
return false;
// TODO: Make this an interaction between the NPC and the vortex
// Become ragdoll
CTakeDamageInfo info( this, this, 1.0f, DMG_GENERIC );
CBaseEntity *pRagdoll = CreateServerRagdoll( pBCC, 0, info, COLLISION_GROUP_INTERACTIVE_DEBRIS, true );
pRagdoll->SetCollisionBounds( pVictim->CollisionProp()->OBBMins(), pVictim->CollisionProp()->OBBMaxs() );
// Necessary to cause it to do the appropriate death cleanup
CTakeDamageInfo ragdollInfo( this, this, 10000.0, DMG_GENERIC | DMG_REMOVENORAGDOLL );
pVictim->TakeDamage( ragdollInfo );
// Return the pointer to the ragdoll
*pPhysObj = pRagdoll->VPhysicsGetObject();
return true;
}
// Wasn't able to ragdoll this target
*pPhysObj = NULL;
return false;
}