本文整理汇总了C++中IActor::IsFriendlyEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ IActor::IsFriendlyEntity方法的具体用法?C++ IActor::IsFriendlyEntity怎么用?C++ IActor::IsFriendlyEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActor
的用法示例。
在下文中一共展示了IActor::IsFriendlyEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShouldSpawnBackSideEffect
bool CCannonBall::ShouldSpawnBackSideEffect(IEntity* pHitTarget)
{
if(m_backSideEffectsDisabled)
return false;
if(m_ownerIsPlayer && pHitTarget)
{
IActor* pTarget = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pHitTarget->GetId());
if(pTarget)
{
CGameRules* pGameRules = g_pGame->GetGameRules();
if (pGameRules && pGameRules->GetFriendlyFireRatio() <= 0.f)
{
//if friendly fire is off don't spawn blood effect on teammates
return !pTarget->IsFriendlyEntity(m_ownerId);
}
}
}
return true;
}
示例2: StickToEntity
bool CStickyProjectile::StickToEntity( const SStickParams& stickParams, IEntity* pTargetEntity )
{
IEntity* pProjectileEntity = stickParams.m_pProjectile->GetEntity();
ICharacterInstance* pCharInstance = pTargetEntity->GetCharacter(0);
if( pCharInstance)
{
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pTargetEntity->GetId());
if (!pActor || (stickParams.m_bStickToFriendlies || !pActor->IsFriendlyEntity(stickParams.m_ownerId)) && (gEnv->bMultiplayer || !pActor->IsDead()))
{
m_stuckJoint = GetJointIdFromPartId(*pTargetEntity, stickParams.m_targetPartId);
m_stuckNormal = stickParams.m_stickNormal;
m_stuckPartId = stickParams.m_targetPartId;
ICharacterModelSkeleton* pICharacterModelSkeleton = pCharInstance->GetICharacterModel()->GetICharacterModelSkeleton();
ISkeletonPose* pSkeleton = pCharInstance->GetISkeletonPose();
const char* boneName = pICharacterModelSkeleton->GetJointNameByID(m_stuckJoint);
const QuatT jointWorld = QuatT(pTargetEntity->GetWorldTM()) * pSkeleton->GetAbsJointByID(m_stuckJoint);
QuatT loc;
CalculateLocationForStick( *pProjectileEntity, stickParams.m_stickPosition, stickParams.m_stickNormal, loc );
pProjectileEntity->SetWorldTM(Matrix34(loc));
// Get the local pos and rot.
loc = jointWorld.GetInverted() * loc;
m_stuckPos = loc.t;
m_stuckRot = loc.q;
// Attach.
if(AttachToCharacter( stickParams.m_pProjectile, *pTargetEntity, *pCharInstance, boneName))
{
m_flags |= eSF_IsStuck;
m_flags |= pActor ? pActor->IsPlayer() ? eSF_StuckToPlayer : eSF_StuckToAI : 0;
SetParentId(pTargetEntity->GetId());
m_childId = pProjectileEntity->GetId();
return true;
}
}
}
else
{
m_stuckNormal = stickParams.m_stickNormal;
m_stuckPartId = stickParams.m_targetPartId;
QuatT loc;
CalculateLocationForStick( *pProjectileEntity, stickParams.m_stickPosition, stickParams.m_stickNormal, loc );
AttachTo(stickParams.m_pProjectile, pTargetEntity);
pProjectileEntity->SetWorldTM(Matrix34(loc));
// Set as Stuck.
SetParentId(pTargetEntity->GetId());
m_childId = pProjectileEntity->GetId();
m_flags |= eSF_IsStuck;
//Store position and rotation relative to parent entity
m_stuckPos = pProjectileEntity->GetPos();
m_stuckRot = pProjectileEntity->GetRotation();
return true;
}
return false;
}