Ejemplo n.º 1
0
void ParticleEffect::Update( sf::Time DeltaTime )
{
	for(unsigned int i = 0; i < m_Particles.size(); i++)
	{
		m_Particles[i]->Update(DeltaTime);
		ProcessParticle(DeltaTime, m_Particles[i]);
		if(m_Particles[i]->deleteMe || (m_Particles[i]->LifeTime != Particle::LIFETIME_INFINITE && m_Particles[i]->Lived >= m_Particles[i]->LifeTime))
		{
			delete m_Particles[i];
			m_Particles.erase(m_Particles.begin() + i);
			if(m_Particles.size() <= 0)
				deleteMe = true;
		}
	}
}
Ejemplo n.º 2
0
void ParticleSystemLoader::ProcessEmiter (TiXmlElement* xmlElem, ParticleSystem* partSys, 
	const std::string& filename)
{
	Emiter* emiter = CreateEmiter (xmlElem, filename);

	TiXmlElement* content = xmlElem->FirstChildElement ();

	while (content) {
		std::string name = content->Value ();

		if (name == "Particle") {
			ProcessParticle (content, emiter, filename);
		}
		else if (name == "Transform") {
			ProcessTransform (content, emiter);
		}
		else if (name == "EmissionShape") {
			ProcessEmisShape (content, emiter);
		}
		else if (name == "ScaleCurve") {
			ProcessScaleCurve (content, emiter);
		}
		else if (name == "SpeedCurve") {
			ProcessTweenCurve (content, emiter);
		}
		else if (name == "LifetimeRange") {
			ProcessLifetimeRange (content, emiter);
		}
		else if (name == "SpeedRange") {
			ProcessSpeedRange (content, emiter);
		}
		else if (name == "ScaleRange") {
			ProcessScaleRange (content, emiter);
		}

		content = content->NextSiblingElement ();
	}

	partSys->SetEmiter (emiter);
}