本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}