private void Fire() { if (FireCooldown <= 0) { CanFire = true; } if (!IsDestroyed && CanFire) { Point bulletCenter = new Point(Center.X, Center.Y + 10); double rise = Enemy.Center.Y - Center.Y; double run = Enemy.Center.X - Center.X; double dist = Math.Sqrt(run * run + rise * rise); double scale = dist / .1; rise = rise / scale; run = run / scale; Point bulletTrajectory = new Point(Enemy.Center.X, Enemy.Center.Y); Ordnance o = new Bullet(SaucerColor, bulletCenter, bulletTrajectory, .01, 200); Ordnances.Add(o); AddToDisplay(o); CanFire = false; FireCooldown = (int)(60 / DifficultyModifier); } }
public override void Move() { TranslateShip(); Fire(); Ordnances.RemoveAll(ord => { return(!ord.Move() ? RemoveFromDisplay(ord) : false); }); Effects.RemoveAll(effect => { return(!effect.Display() ? RemoveFromDisplay(effect) : false); }); DestroyedTimeoutCooldown(); WeaponCooldown(); }
public override void Move() { Thrust(); Rotate(); TranslateShip(); Effects.RemoveAll(effect => { return(!effect.Display() ? RemoveFromDisplay(effect) : false); }); Ordnances.RemoveAll(ord => { return(!ord.Move() ? RemoveFromDisplay(ord) : false); }); DestroyedTimeoutCooldown(); InvincibilityCooldown(); WeaponCooldown(); WarpAbilityCooldown(); }
public void Fire() { if (FireCooldown <= 0) { CanFire = true; } if (!IsDestroyed && CanFire) { Ordnance o = new Bullet(PlayerColor, Center, Trajectory, 80, 200); Ordnances.Add(o); Parent.Children.Add(o.Geometry); CanFire = false; FireCooldown = (int)(15 * DifficultyModifier); } }
private void FireLaser() { if (LaserCooldown <= 0) { CanFireLaser = true; } if (!IsDestroyed && CanFireLaser) { Point laserStart = new Point(Center.X, Center.Y + 60); Point laserEnd = new Point(Enemy.Center.X, Enemy.Center.Y); Ordnance o = new Laser(SaucerColor, laserStart, laserEnd, .01, 50); Ordnances.Add(o); AddToDisplay(o); LaserCooldown = 900; CanFireLaser = false; } }
private void Fire() { if (FireCooldown <= 0) { CanFireBullet = true; } if (!IsDestroyed && CanFireBullet) { Point bulletCenter = new Point(Center.X, Center.Y); Point bulletTrajectory = new Point(Enemy.Center.X, Enemy.Center.Y); Ordnance o = new Bullet(SaucerColor, bulletCenter, bulletTrajectory, .01, 200); Ordnances.Add(o); AddToDisplay(o); CanFireBullet = false; FireCooldown = (int)(60 / DifficultyModifier); } FireLaser(); }