ParticleEffect* ParticleManager::_AddEffect(const ParticleEffectDef *def, float x, float y)
{
	if (!def) {
		IF_PRINT_WARNING(VIDEO_DEBUG)
			<< "AddEffect() failed because def was NULL!" << std::endl;
		return 0;
	}

	if (def->_systems.empty()) {
		IF_PRINT_WARNING(VIDEO_DEBUG)
			<< "AddEffect() failed because def->_systems was empty!" << std::endl;
		return 0;
	}

	ParticleEffect *effect = _CreateEffect(def);
	if (!effect) {
		IF_PRINT_WARNING(VIDEO_DEBUG)
			<< "Could not create particle effect!" << std::endl;
		return 0;
	}

	effect->Move(x, y);
	_all_effects.push_back(effect);
	_active_effects.push_back(effect);

	return effect;
};
Beispiel #2
0
bool ParticleManager::AddParticleEffect(const std::string &effect_filename, float x, float y)
{

    ParticleEffect *effect = new ParticleEffect(effect_filename);
    if(!effect->IsLoaded()) {
        PRINT_WARNING << "Failed to add effect to particle manager" <<
                      " for file: " << effect_filename << std::endl;
        delete effect;
        return false;
    }

    effect->Move(x, y);
    _all_effects.push_back(effect);
    _active_effects.push_back(effect);

    return true;
}