Esempio n. 1
0
		private void AddVerticesToBatch(ParticleEmitter emitter)
		{
			particles = emitter.GetInterpolatedArray<Particle>(emitter.NumberOfActiveParticles);
			var length = particles.Length;
			for (int index = 0; index < length; index++)
				AddIndicesAndVerticesForParticle(index);
		}
Esempio n. 2
0
		private void Create()
		{
			Name = selectedLevelObject;
			levelObject =
				new ParticleEmitter(ContentLoader.Load<ParticleEmitterData>(selectedLevelObject),
					new Vector3D(position.X, position.Y, 0.2f));
		}
Esempio n. 3
0
		private void AddVerticesToBatch(ParticleEmitter emitter)
		{
			var particles = emitter.GetInterpolatedArray<Particle>(emitter.NumberOfActiveParticles);
			var material = emitter.EmitterData.ParticleMaterial;
			var length = particles.Length;
			for (int i = 0; i < length; i++)
			{
				if (!particles[i].IsActive)
					continue; //ncrunch: no coverage
				var batch = (Batch3D)renderer.FindOrCreateBatch(material, material.DiffuseMap.BlendMode);
				UpdateTransformMatrix(particles[i], emitter.EmitterData.BillboardMode);
				var particleVertices = particles[i].GetVertices(particles[i].Size, particles[i].Color);
				for (int v = 0; v < particleVertices.Length; v++)
					particleVertices[v].Position = lastParticleTransform * particleVertices[v].Position;
				batch.AddIndices();
				batch.verticesColorUV[batch.verticesIndex++] = particleVertices[0];
				batch.verticesColorUV[batch.verticesIndex++] = particleVertices[1];
				batch.verticesColorUV[batch.verticesIndex++] = particleVertices[2];
				batch.verticesColorUV[batch.verticesIndex++] = particleVertices[3];
			}
		}
Esempio n. 4
0
		} //ncrunch: no coverage end

		private void AddZoomingBrick(Sprite brick)
		{
			zoomBrickData.ParticleMaterial = brick.Material;
			zoomBrickData.Size = new RangeGraph<Size>(brick.Size, brick.Size * 2);
			var zoomBrickEmitter = new ParticleEmitter(zoomBrickData, brick.Center);
			zoomBrickEmitter.RenderLayer = 16;
			zoomBrickEmitter.SpawnAndDispose();
		}
Esempio n. 5
0
		private void CreateExplosionEmitter(Vector2D position, float length)
		{
			var explosionEmitter = new ParticleEmitter(explosionData, position) { RenderLayer = 10 };
			explosionEmitter.DisposeAfterSeconds(length);
		}
Esempio n. 6
0
		protected override void Preview(string contentName)
		{
			var particleEmitterData = ContentLoader.Load<ParticleEmitterData>(contentName);
			currentDisplayParticle2D = new ParticleEmitter(particleEmitterData,
				new Vector3D(0.5f, 0.5f, 0));
		}
Esempio n. 7
0
		public void DisposeEmitter(ParticleEmitter emitter)
		{
			AttachedEmitters.Remove(emitter);
			emitter.IsActive = false;
		}
Esempio n. 8
0
		public void RemoveEmitter(ParticleEmitter emitter)
		{
			AttachedEmitters.Remove(emitter);
		}
Esempio n. 9
0
		public void AttachEmitter(ParticleEmitter emitter)
		{
			AttachedEmitters.Add(emitter);
			emitter.Position = Position;
			emitter.Rotation = Orientation;
		}
Esempio n. 10
0
		private void CreateExplosion(Vector2D collision)
		{
			var explosion = new ParticleEmitter(explosionData, collision) { RenderLayer = 16 };
			explosion.SpawnAndDispose();
		}
		public void AddEmitterToSystem(ParticleEmitter existingEmitter = null)
		{
			currentEffect.AttachEmitter(existingEmitter ??
				new ParticleEmitter(CreateDefaultEmitterData(), Vector3D.Zero));
			currentEmitterInEffect = currentEffect.AttachedEmitters.Count - 1;
			RefreshAllEffectProperties();
			RaisePropertyChanged("AvailableEmitterIndices");
		}