Beispiel #1
0
        public void Use(string input)
        {
            string text = input;

            string[] inputs = text.Split(' ');


            var query = PlayerBag.Where(i => i.ItemName.Equals(inputs[1]))
                        .Select(d => d).ToList();

            if (query[0].ItemName == "KEY")
            {
                PresentLocation.FindDoor(PresentLocation);
            }
            if (query[0].ItemName != "KEY")
            {
                Console.WriteLine("Sorry you need to find the key first");
            }
        }
Beispiel #2
0
        public void Give(string input)
        {
            string text = input;

            string[] inputs = text.Split(' ');

            var query = PresentLocation.RoomInventory.Where(i => i.ItemName.Equals(inputs[1]))
                        .Select(d => d).ToList();


            foreach (Item i in PlayerBag)
            {
                if (i.ItemName == "TOY")
                {
                    if (query[0].ItemName == "CAT")
                    {
                        PresentLocation.GiveCat(input);
                        break;
                    }
                }
            }
        }
Beispiel #3
0
        public void EnterNewRoom(string input)
        {
            string text = input;

            string[] inputs = text.Split(' ');
            var      query1 = inputs.Where(i => i == "FORWARD" || i == "BACKWARD")
                              .Select(i => i).ToList();

            var query = PresentLocation.ListOfDoors.Where(d => d.Direction == query1[0])
                        .Select(d => d).ToList();

            PresentLocation = query[0].LeadsTo;

            if (PresentLocation.GameOver == true)
            {
                Console.WriteLine(query[0].LeadsTo.RoomName);
                Console.WriteLine(PresentLocation.RoomDescription);
                Alive = false;
            }
            else
            {
                PresentLocation.PrintDescription(PresentLocation);
            }
        }
Beispiel #4
0
 public void Look(string input)
 {
     PresentLocation.PrintDescription(PresentLocation); //skriver ut rummets beskrivning och föremål
     PrintPlayerBag(PresentLocation);
 }