本文整理汇总了C++中IVehicleSystem::GetDamagesTemplateRegistry方法的典型用法代码示例。如果您正苦于以下问题:C++ IVehicleSystem::GetDamagesTemplateRegistry方法的具体用法?C++ IVehicleSystem::GetDamagesTemplateRegistry怎么用?C++ IVehicleSystem::GetDamagesTemplateRegistry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVehicleSystem
的用法示例。
在下文中一共展示了IVehicleSystem::GetDamagesTemplateRegistry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseDamagesGroup
//------------------------------------------------------------------------
bool CVehicleDamagesGroup::ParseDamagesGroup(const CVehicleParams& table)
{
if (table.haveAttr("useTemplate"))
{
IVehicleSystem* pVehicleSystem = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem();
CRY_ASSERT(pVehicleSystem);
if (IVehicleDamagesTemplateRegistry* pDamageTemplReg = pVehicleSystem->GetDamagesTemplateRegistry())
pDamageTemplReg->UseTemplate(table.getAttr("useTemplate"), this);
}
if (CVehicleParams damagesSubGroupsTable = table.findChild("DamagesSubGroups"))
{
int i = 0;
int c = damagesSubGroupsTable.getChildCount();
for (; i < c; i++)
{
if (CVehicleParams groupTable = damagesSubGroupsTable.getChild(i))
{
m_damageSubGroups.resize(m_damageSubGroups.size() + 1);
SDamagesSubGroup& subGroup = m_damageSubGroups.back();
subGroup.id = m_damageSubGroups.size() - 1;
subGroup.m_isAlreadyInProcess = false;
if (!groupTable.getAttr("delay", subGroup.m_delay))
subGroup.m_delay = 0.0f;
if (!groupTable.getAttr("randomness", subGroup.m_randomness))
subGroup.m_randomness = 0.0f;
if (CVehicleParams damageBehaviorsTable = groupTable.findChild("DamageBehaviors"))
{
int k = 0;
int numDamageBehaviors = damageBehaviorsTable.getChildCount();
subGroup.m_damageBehaviors.reserve(c);
for (; k < numDamageBehaviors; k++)
{
if (CVehicleParams behaviorTable = damageBehaviorsTable.getChild(k))
{
if (IVehicleDamageBehavior* pDamageBehavior = ParseDamageBehavior(behaviorTable))
{
subGroup.m_damageBehaviors.push_back(pDamageBehavior);
CVehicleDamageBehaviorDestroy *pDamageDestroy = CAST_VEHICLEOBJECT(CVehicleDamageBehaviorDestroy, pDamageBehavior);
if (pDamageDestroy)
{
TVehiclePartVector& parts = m_pVehicle->GetParts();
for (TVehiclePartVector::iterator ite = parts.begin(); ite != parts.end(); ++ite)
{
IVehiclePart* pPart = ite->second;
if (CVehiclePartAnimatedJoint* pAnimJoint = CAST_VEHICLEOBJECT(CVehiclePartAnimatedJoint, pPart))
{
if (pAnimJoint->IsPhysicalized() && !pAnimJoint->GetDetachBaseForce().IsZero())
{
CVehicleDamageBehaviorDetachPart* pDetachBehavior = new CVehicleDamageBehaviorDetachPart;
pDetachBehavior->Init(m_pVehicle, pAnimJoint->GetName(), pDamageDestroy->GetEffectName());
subGroup.m_damageBehaviors.push_back(pDetachBehavior);
}
}
}
}
}
}
}
}
}
}
}
return true;
}