public void handler() { updateWorld(); render(); ConsoleKeyInfo k = Console.ReadKey(true); switch (k.Key) { case ConsoleKey.UpArrow: hero.goToDirection(0, -1); break; case ConsoleKey.DownArrow: hero.goToDirection(0, 1); break; case ConsoleKey.RightArrow: hero.goToDirection(1, 0); break; case ConsoleKey.LeftArrow: hero.goToDirection(-1, 0); break; } }
static void gameHandler(Creature hero) { ConsoleKeyInfo key; while (hero.isAlive()) { right_i = 4; updateUI(hero, info); key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.L: { resetToDefault(hero); break; } case ConsoleKey.G: { resetToDefault(hero); choiceDirection(); info = "ChoiceDirection"; updateUI(hero, info); resetToDefault(hero); ConsoleKeyInfo choice = Console.ReadKey(true); switch (choice.Key) { case ConsoleKey.W: //Вверх addToLog(hero.goToDirection(0, 1)); break; case ConsoleKey.Q: //Вверх влево addToLog(hero.goToDirection(-1, 1)); break; case ConsoleKey.A: //влево addToLog(hero.goToDirection(-1, 0)); break; case ConsoleKey.Z: //вниз влево addToLog(hero.goToDirection(-1, -1)); break; case ConsoleKey.X: //вниз addToLog(hero.goToDirection(0, -1)); break; case ConsoleKey.C: //Вниз вправо addToLog(hero.goToDirection(1, -1)); break; case ConsoleKey.D: //вправо addToLog(hero.goToDirection(1, 0)); break; case ConsoleKey.E: //вверх вправо addToLog(hero.goToDirection(1, 1)); break; case ConsoleKey.S: break; } resetToDefault(hero); break; } //end of case case ConsoleKey.T: { resetToDefault(hero); info = "SelectTarget"; updateUI(hero, info); int choice_target = Convert.ToInt32(Console.ReadLine()); hero.selectTarget(hero.getLocation().creatures [choice_target]); addToLog(hero.name + " выбрал целью " + hero.getLocation().creatures [choice_target].name); resetToDefault(hero); right_i = 4; updateUI(hero, info); break; } case ConsoleKey.A: { addToLog(hero.attack(hero.getTarget())); if (/* hero.isInBattle && */ hero.getTarget() != null) { info = "FightInfo"; } else { resetToDefault(hero); } break; } case ConsoleKey.P: { info = "ChoiceItemToPick"; updateUI(hero, info); int item = Convert.ToInt32(Console.ReadLine()); addToLog(hero.pickUpItem(hero.getLocation().getItems() [item])); resetToDefault(hero); break; } case ConsoleKey.I: { info = "Inventory"; updateUI(hero, info); right_i = 4; break; } case ConsoleKey.S: { info = "drawHeroStats"; updateUI(hero, info); break; } case ConsoleKey.U: { switch (Console.ReadKey(true).Key) { case ConsoleKey.S: addToLog("Выберите характеристику для улучшения"); updateUI(hero, "drawHeroStats"); string choice = Console.ReadLine(); addToLog(hero.upgradeStat(Convert.ToInt32(choice))); break; } break; } } //end of switch for (int i = 0; i < hero.getLocation().creatures.Count; i++) { if (hero.getLocation().creatures [i].isEnemy) { addToLog(((IEnemy)(hero.getLocation().creatures [i])).AI(hero)); } } for (int i = 0; i < hero.buffs.Count; i++) { hero.buffs [i].update(); } updateUI(hero, info); } Console.WriteLine("Лол ты сдох"); }