Пример #1
0
 public override void Remove(Component c)
 {
     if (c.GetType() == typeof(PirateShip))
     {
         Console.ForegroundColor = ConsoleColor.Green;
         pirate = null;
         Console.WriteLine("Уничтожен пират");
         Console.ResetColor();
     }
     if (c.GetType() == typeof(AsteroidField))
     {
         Console.ForegroundColor = ConsoleColor.Green;
         asteroid_field          = null;
         Console.WriteLine("Уничтожены астероиды");
         Console.ResetColor();
     }
     if (c.GetType() == typeof(MainShip))
     {
         Console.ForegroundColor = ConsoleColor.Green;
         player_ship             = null;
         Console.WriteLine("Уничтожен игрок - конец игры!");
         Console.ResetColor();
     }
     if (c.GetType() == typeof(BossShip))
     {
         Console.ForegroundColor = ConsoleColor.Green;
         boss = null;
         Console.WriteLine("Уничтожен босс - переход на новый уровень!");
         Console.ResetColor();
     }
 }
Пример #2
0
 public override void Add(Component c)
 {
     if (c.GetType() == typeof(PirateShip))
     {
         pirate = (PirateShip)c;
     }
     if (c.GetType() == typeof(AsteroidField))
     {
         asteroid_field = (AsteroidField)c;
     }
     if (c.GetType() == typeof(MainShip))
     {
         player_ship = (MainShip)c;
     }
     if (c.GetType() == typeof(BossShip))
     {
         boss = (BossShip)c;
     }
 }