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


C++ IVehicleSystem::GetDamagesTemplateRegistry方法代码示例

本文整理汇总了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;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:77,代码来源:VehicleDamagesGroup.cpp


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