protected override void AddBullets(Vector launchPosition) { IBullet bullet = Ammo.Create(launchPosition); ImbueBullet(bullet); BulletAdder(bullet); }
protected override void AddBullets(Vector launchPosition) { IBullet leftBullet; IBullet rightBullet; if (recycledShots.Count > 1) { leftBullet = (IBullet)recycledShots[recycledShots.Count - 1]; rightBullet = (IBullet)recycledShots[recycledShots.Count - 2]; recycledShots.RemoveRange(recycledShots.Count - 2, 2); SetBulletsPosition(leftBullet, rightBullet, launchPosition); RecycledBulletAdder(leftBullet); RecycledBulletAdder(rightBullet); } else { leftBullet = Ammo.Create(launchPosition); rightBullet = Ammo.Create(launchPosition); ImbueBullet(leftBullet); ImbueBullet(rightBullet); SetBulletsPosition(leftBullet, rightBullet, launchPosition); BulletAdder(leftBullet); BulletAdder(rightBullet); } }
protected override void AddBullets(Vector launchPosition) { IBullet leftBullet; IBullet middleBullet; IBullet rightBullet; if (recycledShots.Count > 2) { leftBullet = (IBullet)recycledShots[recycledShots.Count - 1]; middleBullet = (IBullet)recycledShots[recycledShots.Count - 2]; rightBullet = (IBullet)recycledShots[recycledShots.Count - 3]; launchPosition.Y += leftBullet.Size.Y * (int)leftBullet.Direction; launchPosition.X -= leftBullet.Size.X; leftBullet.Position = launchPosition; launchPosition.X += leftBullet.Size.X; middleBullet.Position = launchPosition; launchPosition.X += leftBullet.Size.X; rightBullet.Position = launchPosition; recycledShots.RemoveRange(recycledShots.Count - 3, 3); leftBullet.Speed = new Vector(-5, leftBullet.Speed.Y); middleBullet.Speed = new Vector(0, middleBullet.Speed.Y); rightBullet.Speed = new Vector(5, rightBullet.Speed.Y); RecycledBulletAdder(leftBullet); RecycledBulletAdder(middleBullet); RecycledBulletAdder(rightBullet); } else { leftBullet = Ammo.Create(launchPosition); launchPosition.X -= leftBullet.Size.X; launchPosition.Y += leftBullet.Size.Y * (int)leftBullet.Direction; leftBullet.Position = launchPosition; launchPosition.X += leftBullet.Size.X; middleBullet = Ammo.Create(launchPosition); launchPosition.X += leftBullet.Size.X; rightBullet = Ammo.Create(launchPosition); leftBullet.Speed = new Vector(-5, leftBullet.Speed.Y); rightBullet.Speed = new Vector(5, rightBullet.Speed.Y); ImbueBullet(leftBullet); ImbueBullet(middleBullet); ImbueBullet(rightBullet); BulletAdder(leftBullet); BulletAdder(middleBullet); BulletAdder(rightBullet); } }
protected override void AddBullets(Vector launchPosition) { IBullet bullet; if (recycledShots.Count > 0) { bullet = (IBullet)recycledShots.Last(); launchPosition.Y += bullet.Size.Y * (int)bullet.Direction; bullet.Position = launchPosition; recycledShots.RemoveAt(recycledShots.Count - 1); RecycledBulletAdder(bullet); } else { bullet = Ammo.Create(launchPosition); launchPosition.Y += bullet.Size.Y * (int)bullet.Direction; bullet.Position = launchPosition; ImbueBullet(bullet); BulletAdder(bullet); } }