Ejemplo n.º 1
0
        public void NotifyBattleFinished(Fleet winingFleet, Fleet loosingFleet,
            int numberOfBattleRounds)
        {
            WriteNewLine();
            textBox.AppendText("After round " + numberOfBattleRounds
                               + " the " + winingFleet.FleetName + " fleet won");
            WriteNewLine();

            textBox.AppendText("  " + loosingFleet.TotalNumberOfLosses + " enemy ships destroyed");
            WriteNewLine();
            textBox.AppendText("  " + winingFleet.TotalNumberOfLosses + " ships lost");
            WriteNewLine();
            textBox.AppendText("  " + winingFleet.SizeOfActiveFleet + " ships survived");
            WriteNewLine();

            foreach (BaseShip spaceShip in winingFleet.ShipsInService)
            {
                string damage = spaceShip.DamageStatus();
                textBox.AppendText("    " + spaceShip.ShipClass + " - " + damage);
                WriteNewLine();
            }
        }
Ejemplo n.º 2
0
 public SpaceBattle(Fleet fleet1, Fleet fleet2)
 {
     this.fleet1 = fleet1;
     this.fleet2 = fleet2;
 }
Ejemplo n.º 3
0
 private Fleet CreateFleet(Random random, string fleetFile)
 {
     Fleet fleet = new Fleet(random);
     fleet.ReadFleet(fleetFile);
     return fleet;
 }
Ejemplo n.º 4
0
 private void NotifyObserversBattleFinished(Fleet winingFleet, Fleet loosingFleet)
 {
     foreach (IBattleObserver battleObserver in observers)
     {
         battleObserver.NotifyBattleFinished(winingFleet, loosingFleet, battleRounds);
     }
 }