Пример #1
0
        public void Go(string direction)
        {
            List <string> directions = new List <string>()
            {
                "north", "east", "south", "west"
            };

            if (!directions.Contains(direction))
            {
                // sorry, there aren't any waffle emojis
                Console.WriteLine("Never eat soggy waffles."); // 🥞
                return;
            }

            if (!CurrentRoom.HasExit(direction))
            {
                Console.WriteLine("That's a wall"); // 🤦
                return;
            }

            if (CurrentRoom.Locked == direction)
            {
                Console.WriteLine("It's locked, maybe there's a key nearby."); // 🤔
                return;
            }

            CurrentRoom = CurrentRoom.GetExit(direction);
            if (CurrentRoom == WinRoom)
            {
                GameWon = true;
                Console.WriteLine("Congrats you won the game! Now go write some code."); // 🎉
                return;
            }
            Look();
            if (CurrentRoom.KillsPlayer)
            {
                GameLost = true;
                Thread.Sleep(500);
                Console.WriteLine("Wow, you died already... mind blown."); // 🤯
                return;
            }
            if (CurrentRoom.Name == "Canvas Area")
            {
                CurrentRoom.Lock("west");
            }
        }