コード例 #1
0
void CLocalPlayerComponent::UpdateScreenFadeEffect()
{
	IMaterialEffects* pMaterialEffects = gEnv->pGame->GetIGameFramework()->GetIMaterialEffects();

	if(pMaterialEffects)
	{
		m_screenFadeEffectId = pMaterialEffects->GetEffectIdByName("cw2_player_fx", "c2mp_fallDeath_fadeOut");
	}
}
コード例 #2
0
void CClientHitEffectsMP::ProcessEffectInfo(SHitEffectInfoSet& hitEffectSet, XmlNodeRef xmlNode, const char* libraryName)
{
    bool foundDefault = false;
    bool foundMelee = false;
    const uint numEffects = xmlNode->getChildCount();
    IMaterialEffects* pMaterialEffects = gEnv->pMaterialEffects;
    IEntityClassRegistry* pClassRegistry = gEnv->pEntitySystem->GetClassRegistry();

    hitEffectSet.m_effectInfos.reserve(numEffects);

    for (uint i = 0; i < numEffects; i++)
        {
            if(XmlNodeRef childNode = xmlNode->getChild(i))
                {
                    if(const char* nameTag = childNode->getTag())
                        {
                            if(!foundDefault && !strcmp("default", nameTag))
                                {
                                    const char* effectName = childNode->getAttr("effect");

                                    if(effectName)
                                        {
                                            hitEffectSet.m_default = pMaterialEffects->GetEffectIdByName(libraryName, effectName);
                                        }

                                    foundDefault = true;
                                }
                            else if(!foundMelee && !strcmp("melee", nameTag))
                                {
                                    const char* effectName = childNode->getAttr("effect");

                                    if(effectName)
                                        {
                                            hitEffectSet.m_melee = pMaterialEffects->GetEffectIdByName(libraryName, effectName);
                                        }

                                    foundMelee = true;
                                }
                            else
                                {
                                    SHitEffectInfo newInfo;

                                    newInfo.pAmmoClass = pClassRegistry->FindClass(nameTag);

                                    const char* effectName = childNode->getAttr("effect");

                                    if(effectName)
                                        {
                                            newInfo.effectId = pMaterialEffects->GetEffectIdByName(libraryName, effectName);
                                        }

                                    if(newInfo.pAmmoClass && newInfo.effectId)
                                        {
                                            hitEffectSet.m_effectInfos.push_back(newInfo);
                                        }
                                    else
                                        {
                                            if(!newInfo.pAmmoClass)
                                                {
                                                    GameWarning("Class type %s does not exist", nameTag);
                                                }

                                            if(!newInfo.effectId)
                                                {
                                                    GameWarning("Material Effect %s does not exist", effectName ? effectName : "");
                                                }
                                        }
                                }
                        }
                }
        }

    if(!hitEffectSet.m_melee)
        {
            hitEffectSet.m_melee = hitEffectSet.m_default;
        }
}