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; } } } } } }