public void addBullet(Character c, Color col, int damage) { Vector2 vel = c.getVel() * 0.1f; vel += (new Vector2((float)Math.Cos(c.getRotation() - Math.PI / 2), (float)Math.Sin(c.getRotation() - Math.PI / 2))) * 4.0f; List <Bullet> l; if (c is Player) { vel *= 3.0f; l = playerBullets; soundManager.playerFire(); } else { vel *= 1.5f; l = enemyBullets; if (enemyBullets.Count < 100) { soundManager.enemyFire(); } } Bullet b = new Bullet(bulletSprite, c.getPos(), vel, 1, levelManager, col, damage); b.setRotation(c.getRotation()); l.Add(b); }
public void addBullet(Character c, Color col, int damage) { Vector2 vel = c.getVel() * 0.1f; vel += (new Vector2((float)Math.Cos(c.getRotation() - Math.PI / 2), (float)Math.Sin(c.getRotation() - Math.PI / 2))) * 4.0f; List<Bullet> l; if (c is Player) { vel *= 3.0f; l = playerBullets; soundManager.playerFire(); } else { vel *= 1.5f; l = enemyBullets; if (enemyBullets.Count < 100) { soundManager.enemyFire(); } } Bullet b = new Bullet(bulletSprite, c.getPos(), vel, 1, levelManager, col, damage); b.setRotation(c.getRotation()); l.Add(b); }