示例#1
0
        public static void CreatePlayer()
        {
            Dialogues.Write("welcome");
            var name = ReadName();

            Game.m_Player = new Player(name, Game.GenerateRoom());
        }
示例#2
0
        public static void ReadCommand()
        {
            Dialogues.Write("wait_command");
            var command = Console.ReadLine().ToLower();

            DoCommand(command);
        }
示例#3
0
 public void ShowItems()
 {
     if (Items.Count == 0)
     {
         Dialogues.Write("no_items");
         return;
     }
     Dialogues.Write("show_items");
     Items.ToList().ForEach(i => Console.WriteLine(i.Name));
 }
示例#4
0
 private void GoLeft()
 {
     if (!CurrentRoom.IsOnLeftBorder())
     {
         CurrentRoom = Game.Rooms[CurrentRoom.X, CurrentRoom.Y - 1];
     }
     else
     {
         Dialogues.Write("no_west");
     }
 }
示例#5
0
 private void GoUp()
 {
     if (!CurrentRoom.IsOnTopBorder())
     {
         CurrentRoom = Game.Rooms[CurrentRoom.X - 1, CurrentRoom.Y];
     }
     else
     {
         Dialogues.Write("no_north");
     }
 }
示例#6
0
 private void GoDown()
 {
     if (!CurrentRoom.IsOnBottomBorder())
     {
         CurrentRoom = Game.Rooms[CurrentRoom.X + 1, CurrentRoom.Y];
     }
     else
     {
         Dialogues.Write("no_south");
     }
 }
示例#7
0
 private void GoRight()
 {
     if (!CurrentRoom.IsOnRightBorder())
     {
         CurrentRoom = Game.Rooms[CurrentRoom.X, CurrentRoom.Y + 1];
     }
     else
     {
         Dialogues.Write("no_east");
     }
 }
示例#8
0
        private static string ReadName()
        {
            Dialogues.Write("acquaintance");
            var name = Console.ReadLine();

            if (String.IsNullOrWhiteSpace(name))
            {
                Dialogues.Write("wrong_name");
                ReadName();
            }
            return(name);
        }
示例#9
0
 public void TakeItem(Item item)
 {
     Backpack ??= new List <Item>();
     if (item.IsAlive)
     {
         Backpack.Add(item);
     }
     else
     {
         Dialogues.Write("cannot_take");
     }
 }
示例#10
0
        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;
            }
        }
示例#11
0
 public void ShowInfo()
 {
     Dialogues.Write("show_player_info", Name);
 }