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


C++ CEffectCreator::CreateEffect方法代码示例

本文整理汇总了C++中CEffectCreator::CreateEffect方法的典型用法代码示例。如果您正苦于以下问题:C++ CEffectCreator::CreateEffect方法的具体用法?C++ CEffectCreator::CreateEffect怎么用?C++ CEffectCreator::CreateEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CEffectCreator的用法示例。


在下文中一共展示了CEffectCreator::CreateEffect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateHitEffect

void CWeaponFireDesc::CreateHitEffect (CSystem *pSystem, SDamageCtx &DamageCtx)

//	CreateHitEffect
//
//	Creates an effect when the weapon hits an object

	{
	//	See if this weapon has a hit effect

	CEffectCreator *pHitEffect = m_pHitEffect;

	//	If not, compute a default hit effect depending on the weapon damage type

	if (pHitEffect == NULL)
		pHitEffect = g_pUniverse->FindDefaultHitEffect(m_Damage.GetDamageType());

	//	If we could not come up with a hit effect then we're done.

	if (pHitEffect == NULL)
		return;

	//	Create the effect

	pHitEffect->CreateEffect(pSystem,
			((DamageCtx.pObj && !DamageCtx.pObj->IsDestroyed()) ? DamageCtx.pObj : NULL),
			DamageCtx.vHitPos,
			(DamageCtx.pObj ? DamageCtx.pObj->GetVel() : CVector()),
			DamageCtx.iDirection,
			DamageCtx.iDamage);
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:30,代码来源:CWeaponFireDesc.cpp

示例2: Damage

CSpaceObject::DamageResults CMissile::Damage (CSpaceObject *pCause, const CVector &vHitPos, int iDirection, const DamageDesc &Damage)

//	Damage
//
//	Object takes damage from the given source

	{
	CSpaceObject *pAttacker = pCause->GetDamageCause();

	//	Compute damage

	bool bDestroy = false;
	int iDamage = Damage.RollDamage();
	if (iDamage == 0)
		return damageNoDamage;

	//	If this is a momentum attack then we are pushed

	int iMomentum;
	if (iMomentum = Damage.GetMomentumDamage())
		{
		CVector vAccel = PolarToVector(iDirection, -10 * iMomentum * iMomentum);
		Accelerate(vAccel, g_MomentumConstant);
		ClipSpeed(GetMaxSpeed());
		}

	//	Create a hit effect

	CEffectCreator *pEffect = g_pUniverse->FindEffectType(g_HitEffectUNID);
	if (pEffect)
		pEffect->CreateEffect(GetSystem(),
				this,
				vHitPos,
				GetVel());

	//	Take damage

	if (iDamage < m_iHitPoints)
		{
		m_iHitPoints -= iDamage;
		return damageArmorHit;
		}

	//	We are destroyed

	m_iHitPoints = 0;
	if (m_pDesc->m_iVaporTrailLength)
		{
		m_fDestroyed = true;
		m_iLifeLeft = m_pDesc->m_iVaporTrailLength;
		}
	else
		Destroy(killedByDamage, pAttacker);

	//	A missile might be able to pass through after hitting us

	return damagePassthrough;
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:58,代码来源:CMissile.cpp

示例3: CreateHitEffect

void CMissile::CreateHitEffect (const CVector &vPos, int iRotation)

//	CreateHitEffect
//
//	Create hit effect

{
    CEffectCreator *pEffect;
    if (pEffect = m_pDesc->GetHitEffect())
        pEffect->CreateEffect(GetSystem(),
                              (m_iHitDir == -1 ? NULL : m_pHit),
                              vPos,
                              CVector(),
                              iRotation);
}
开发者ID:alanhorizon,项目名称:Transcendence,代码行数:15,代码来源:CMissile.cpp

示例4: Damage

CSpaceObject::DamageResults CParticleEffect::Damage (CSpaceObject *pCause, const CVector &vHitPos, int iDirection, const DamageDesc &Damage)

//	Damage
//
//	Damage the particle field

	{
	//	Create hit effect

	CEffectCreator *pEffect = g_pUniverse->FindEffectType(g_HitEffectUNID);
	if (pEffect)
		pEffect->CreateEffect(GetSystem(),
				this,
				vHitPos,
				GetVel());

	return damagePassthrough;
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:18,代码来源:CParticleEffect.cpp


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