Пример #1
0
 private void Reset( bool toAddScore, GameTime gameTime )
 {
     bool addScore = toAddScore;
     if ( CheckVictory( gameTime ) ) addScore = true;
     IsGameDone = false;
     Projectiles = new HashSet<ProjectileObject>();
     Projectiles.Add( new AProj( blank, width, height ) );
     Fences = new HashSet<FenceObject>();
     Pickups = new HashSet<Pickup>();
     if ( appearingPowerUp != null )
     {
         appearingPowerUp.Stop();
         appearingPowerUp = null;
     }
     string WinnerString = "";
     foreach ( TankObject Tank in Tanks )
     {
         if ( Tank.IsInGame )
         {
             WinnerString = Tank.TeamString;
         }
     }
     foreach ( TankObject Tank in Tanks )
     {
         if ( Tank.TeamString == WinnerString && addScore )
         {
             Tank.Score++;
         }
         Tank.Reset();
     }
     if ( StartDelay > 0 && toAddScore )
     {
         System.Threading.Thread.Sleep( StartDelay );
     }
     Round = gameTime.TotalGameTime;
     roundDeath = null;
 }
Пример #2
0
 private void BeginSuddenDeath( GameTime gameTime )
 {
     roundDeath = SuddenDeaths[ random.Next( SuddenDeaths.Length ) ];
     roundDeath.Initialize( gameTime, Content );
     if ( roundDeath is SuperNoveyDeath )
     {
         SuperNoveyBlackHole supernova = new SuperNoveyBlackHole( gameTime );
         supernova.LoadTex( Content );
         appearingPowerUp = supernova;
         float speed = 5;
         for ( int i = 0; i < 180; i++ )
         {
             Projectiles.Add( new BasicBullet( Vector2.Zero, 0, gameTime, width, height, speed, new TankObject() ) );
             Projectiles.Add( new BasicBullet( Vector2.UnitX * width, 0, gameTime, width, height, speed, new TankObject() ) );
             Projectiles.Add( new BasicBullet( Vector2.UnitY * height, 0, gameTime, width, height, speed, new TankObject() ) );
             Projectiles.Add( new BasicBullet( new Vector2( width, height ), 0, gameTime, width, height, speed, new TankObject() ) );
         }
     }
 }