本文整理汇总了C++中IActor::GetActorClass方法的典型用法代码示例。如果您正苦于以下问题:C++ IActor::GetActorClass方法的具体用法?C++ IActor::GetActorClass怎么用?C++ IActor::GetActorClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActor
的用法示例。
在下文中一共展示了IActor::GetActorClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CPlayer *CScriptBind_HitDeathReactions::GetAssociatedActor(IFunctionHandler *pH) const
{
SmartScriptTable selfTable;
pH->GetSelf(selfTable);
CRY_ASSERT(selfTable->HaveValue("__actor"));
ScriptHandle actorEntityId;
selfTable->GetValue("__actor", actorEntityId);
IActor *pActor = m_pGameFW->GetIActorSystem()->GetActor(static_cast<EntityId>(actorEntityId.n));
// [*DavidR | 13/Nov/2009] WARNING: This downcast could be dangerous if CHitDeathReactions is moved to
// CActor classes
CRY_ASSERT(pActor && (pActor->GetActorClass() == CPlayer::GetActorClassType()));
return static_cast<CPlayer *>(pActor);
}
示例2: ProcessLocalHit
void CGameRules::ProcessLocalHit( const HitInfo& hitInfo, float fCausedDamage /*= 0.0f*/ )
{
//Place the code that should be invoked in both server and client sides here
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(hitInfo.targetId);
if (pActor != NULL && (pActor->GetActorClass() == CPlayer::GetActorClassType()))
{
// Clients sometimes want to force a hit death reaction to play (when the victim isnt actually dead.. but will be when the server responds to a hit req)
CHitDeathReactionsPtr pHitDeathReactions = static_cast<CPlayer*>(pActor)->GetHitDeathReactions();
if (pHitDeathReactions)
{
// If the user has requested the player be force killed, then we need to *react* like this was a kill
if(hitInfo.forceLocalKill)
{
// Force the hit death reaction to react as if was a kill
CActor::KillParams params;
params.shooterId = hitInfo.shooterId;
params.targetId = hitInfo.targetId;
params.weaponId = hitInfo.weaponId;
params.projectileId = hitInfo.projectileId;
params.itemIdToDrop = -1;
params.weaponClassId = hitInfo.weaponClassId;
params.damage = hitInfo.damage;
params.material = -1;
params.hit_type = hitInfo.type;
params.hit_joint = hitInfo.partId;
params.projectileClassId = hitInfo.projectileClassId;
params.penetration = hitInfo.penetrationCount;
params.firstKill = false;
params.killViaProxy = hitInfo.hitViaProxy;
params.impulseScale = hitInfo.impulseScale;
params.forceLocalKill = hitInfo.forceLocalKill;
pHitDeathReactions->OnKill(params);
}
else
{
// Proceed as normal
pHitDeathReactions->OnHit(hitInfo, fCausedDamage);
}
}
}
}