예제 #1
0
 static void Main(string[] args)
 {
     Hero hero = new Hero(name: "Ivan", nickName: "Ruski", health: 100, mana: 100, manaRegenerationRate: 2);
     Enemy enemy = new Enemy(health: 100, mana: 100, damage: 20);
     Weapon wep = new Weapon("Damn", 20);
     hero.Equip(wep);
     Dungeon test = new Dungeon(hero, enemy);
     test.Spawn(hero);
     Commands(test,hero,enemy);
 }
예제 #2
0
 public static void Commands(Dungeon test,Hero hero,Enemy enemy)
 {
     test.PrintMap();
     string inputDirection = string.Empty;
     while (true)
     {
         inputDirection= Console.ReadLine();
         if (inputDirection == "Right")
         {
             Console.WriteLine(test.MoveHero(Direction.Right));
             if (!hero.IsAlive())
             {
                 return;
             }
             if (test.Victory)
             {
                 Console.WriteLine("You won");
                 return;
             }
             test.PrintMap();
         }
         else if (inputDirection == "Left")
         {
             Console.WriteLine(test.MoveHero(Direction.Left));
             if (!hero.IsAlive())
             {
                 return;
             }
             if (test.Victory)
             {
                 Console.WriteLine("You won");
                 return;
             }
             test.PrintMap();
         }
         else if (inputDirection == "Up")
         {
             Console.WriteLine(test.MoveHero(Direction.Up));
             if (!hero.IsAlive())
             {
                 return;
             }
             if (test.Victory)
             {
                 Console.WriteLine("You won");
                 return;
             }                    
             test.PrintMap();
         }
         else if (inputDirection == "Down")
         {
             Console.WriteLine(test.MoveHero(Direction.Down));
             if (!hero.IsAlive())
             {
                 return;
             }
             if (test.Victory)
             {
                 Console.WriteLine("You won");
                 return;
             }
             test.PrintMap();
         }
         else
         {
             Console.WriteLine("Wrong direction");
         }
     }
 }