public static void CreatePlayer() { Dialogues.Write("welcome"); var name = ReadName(); Game.m_Player = new Player(name, Game.GenerateRoom()); }
public static void ReadCommand() { Dialogues.Write("wait_command"); var command = Console.ReadLine().ToLower(); DoCommand(command); }
public void ShowItems() { if (Items.Count == 0) { Dialogues.Write("no_items"); return; } Dialogues.Write("show_items"); Items.ToList().ForEach(i => Console.WriteLine(i.Name)); }
private void GoLeft() { if (!CurrentRoom.IsOnLeftBorder()) { CurrentRoom = Game.Rooms[CurrentRoom.X, CurrentRoom.Y - 1]; } else { Dialogues.Write("no_west"); } }
private void GoUp() { if (!CurrentRoom.IsOnTopBorder()) { CurrentRoom = Game.Rooms[CurrentRoom.X - 1, CurrentRoom.Y]; } else { Dialogues.Write("no_north"); } }
private void GoDown() { if (!CurrentRoom.IsOnBottomBorder()) { CurrentRoom = Game.Rooms[CurrentRoom.X + 1, CurrentRoom.Y]; } else { Dialogues.Write("no_south"); } }
private void GoRight() { if (!CurrentRoom.IsOnRightBorder()) { CurrentRoom = Game.Rooms[CurrentRoom.X, CurrentRoom.Y + 1]; } else { Dialogues.Write("no_east"); } }
private static string ReadName() { Dialogues.Write("acquaintance"); var name = Console.ReadLine(); if (String.IsNullOrWhiteSpace(name)) { Dialogues.Write("wrong_name"); ReadName(); } return(name); }
public void TakeItem(Item item) { Backpack ??= new List <Item>(); if (item.IsAlive) { Backpack.Add(item); } else { Dialogues.Write("cannot_take"); } }
private static void DoCommand(string command) { switch (command) { case "я": Game.m_Player.ShowInfo(); break; case "осмотреться": Game.m_Player.LookAround(); break; case "идти на север": Game.m_Player.Go(Direction.Up); break; case "идти на юг": Game.m_Player.Go(Direction.Down); break; case "идти на восток": Game.m_Player.Go(Direction.Right); break; case "идти на запад": Game.m_Player.Go(Direction.Left); break; case "помощь": Dialogues.Write("help"); break; case "выход": Game.Exit(); break; default: Dialogues.Write("no_command_error"); break; } }
public void ShowInfo() { Dialogues.Write("show_player_info", Name); }