private void OnHitEffect(ParticleEngine particleEngine, Vector2 position, int nrOfParticles, float scale, int timeToLive, Color color1, Color color2, Color color3) { particleEngine.EmitterLocation = new Vector2(position.X, position.Y); for (int i = 0; i < nrOfParticles; i++) { particleEngine.particles.Add(particleEngine.GenerateNewParticle(scale, timeToLive, color1, color2, color3)); } }
public void ParticleEffect() { particleEngine.EmitterLocation = new Vector2(position.X, position.Y); for (int i = 0; i < 1; i++) { particleEngine.particles.Add(particleEngine.GenerateNewParticle(1.0f, 20, Color.White, Color.CornflowerBlue, Color.Aqua)); } for (int particle = 0; particle < particleEngine.particles.Count; particle++) { particleEngine.particles[particle].Update(); if (particleEngine.particles[particle].TimeToLive <= 0) { particleEngine.particles.RemoveAt(particle); particle--; } } }
public void TowerAttack(double deltaTime) { for (int i = 0; i < towers.Count; i++) { towers[i].Update(deltaTime); if (towers[i].canFire) { for (int j = 0; j < creepManager.creepWave.Count; j++) { if (Vector2.Distance(creepManager.creepWave[j].GetPosition(), towers[i].GetPosition()) <= towers[i].Range()) { if (towers[i] is CannonTower) { CannonBall c = new CannonBall(towers[i].GetPosition(), TextureManager.projectileTexture, creepManager.creepWave[j], towers[i].Damage()); projectileManager.projectiles.Add(c); particleEngine.EmitterLocation = new Vector2(towers[i].GetPosition().X, towers[i].GetPosition().Y); for (int z = 0; z < 3; z++) { particleEngine.particles.Add(particleEngine.GenerateNewParticle(1.0f, 20, Color.White, Color.White, Color.White)); } towers[i].canFire = false; break; } if (towers[i] is MagicTower) { FrostOrb f = new FrostOrb(towers[i].GetPosition(), TextureManager.frostOrb, creepManager.creepWave[j], towers[i].Damage()); projectileManager.projectiles.Add(f); towers[i].canFire = false; break; } } } } } }