Beispiel #1
0
 /// <summary>
 /// The run method, runs your example design pattern
 /// and gathers output for the Console in the
 /// passed in StringBuilder.
 /// </summary>
 /// <param name="builder">The StringBuilder to gather output for the Console.</param>
 public override void Run(StringBuilder builder)
 {
     base.Run(builder);
     lock (builder)
     {
         var meleeRate = ((int)(_gun.MeleeRate * 1000));
         var shotRate  = ((int)(_gun.ShotRate * 1000));
         _gun.Melee();
         Thread.Sleep(meleeRate);
         _gun.Shoot();
         Thread.Sleep(shotRate);
         _gun.Shoot();
         Thread.Sleep(shotRate);
         _gun.Shoot();
         Thread.Sleep(shotRate);
         _gun.Melee();
         Thread.Sleep(meleeRate);
         var gun = _gun as IBurstFireGun;
         if (gun != null)
         {
             gun.IsBurstFireEngaged = false;
         }
         _gun.Shoot();
         Thread.Sleep(shotRate);
         _gun.Shoot();
         _gun.Reload(_ammunitionContainer);
     }
 }