Exemplo n.º 1
0
 public static void DestroyShip(double gameTimeSeconds, ShipModel ship, ExplosionListModel explosions, GameSounds gameSounds)
 {
     ship.IsDestroyed       = true;
     ship.TimeOfDestruction = gameTimeSeconds;
     AddExplosion(gameTimeSeconds, ship.CentrePoint, explosions, gameSounds);
 }
Exemplo n.º 2
0
 public static void ConsiderPlayerFiring(double gameTimeSeconds, Input input, ShipBulletListModel shipBulletList, ShipModel ship, GameSounds gameSounds)
 {
     if (!ship.IsDestroyed && input.Fire.JustDown)
     {
         var elapsedTime = gameTimeSeconds - ship.MostRecentPlayerFiringTime;
         if (elapsedTime > ShipModel.MinFiringIntervalForPlayer)
         {
             shipBulletList.ShipBullets.Add(new ShipBulletModel(ship.CentrePoint.ShuntedBy(ship.Width, 0)));
             ship.MostRecentPlayerFiringTime = gameTimeSeconds; // Quiz:  Why are we doing this?
             gameSounds.PlayerFiringSound.Play();
         }
     }
 }