예제 #1
0
 public static void CheckIfAlienShot(double gameTimeSeconds, AlienListModel alienList, ShipBulletListModel shipBulletsList, ExplosionListModel explosionsList, ScoreModel Scoring, GameSounds gameSounds)
 {
     CheckIfAlienShotAndThen(
         gameTimeSeconds, alienList, shipBulletsList, alien =>
     {
         AddExplosion(gameTimeSeconds, alien.CentrePoint, explosionsList, gameSounds);
         Scoring.SetScore(Scoring.Score + 1);
     });
 }
예제 #2
0
        public static void RemoveOffScreenObjects(AlienListModel aliensList, ShipBulletListModel shipBulletList, AlienBulletListModel alienBulletList, StarscapeModel starList, ScoreModel scoring)
        {
            shipBulletList.ShipBullets.RemoveAll(b => b.CentrePoint.x > RetroScreen.WidthInPixels);
            alienBulletList.AlienBullets.RemoveAll(b => b.CentrePoint.x < 0);
            starList.Stars.RemoveAll(s => s.CentrePoint.x < 0);
            int numberOfAliensRemoved = aliensList.Aliens.RemoveAll(a => a.CentrePoint.x < 0);

            scoring.SetScore(Math.Max(0, scoring.Score - numberOfAliensRemoved));
        }